home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 1.toast / pc / tool chest / development kits / hypercard related / xcmds & xfcns / apple event xcmds 1.0b3 / apple event xcmds b3 / background_3808.xml < prev    next >
Encoding:
Extensible Markup Language  |  1993-04-14  |  77.1 KB  |  709 lines

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE background PUBLIC "-//Apple, Inc.//DTD background V 2.0//EN" "" >
  3. <background>
  4.     <id>3808</id>
  5.     <filler1>0</filler1>
  6.     <bitmap>BMAP_7304.pbm</bitmap>
  7.     <cantDelete> <true /> </cantDelete>
  8.     <showPict> <true /> </showPict>
  9.     <dontSearch> <false /> </dontSearch>
  10.     <link rel="stylesheet" type="text/css" href="stylesheet_3179.css" />
  11.     <part>
  12.         <id>1</id>
  13.         <type>button</type>
  14.         <visible> <true /> </visible>
  15.         <reserved5> 0 </reserved5>
  16.         <reserved4> 0 </reserved4>
  17.         <reserved3> 0 </reserved3>
  18.         <reserved2> 0 </reserved2>
  19.         <reserved1> 0 </reserved1>
  20.         <enabled> <true /> </enabled>
  21.         <rect>
  22.             <left>330</left>
  23.             <top>23</top>
  24.             <right>406</right>
  25.             <bottom>42</bottom>
  26.         </rect>
  27.         <style>shadow</style>
  28.         <showName> <true /> </showName>
  29.         <highlight> <false /> </highlight>
  30.         <autoHighlight> <true /> </autoHighlight>
  31.         <sharedHighlight> <true /> </sharedHighlight>
  32.         <family>0</family>
  33.         <titleWidth>0</titleWidth>
  34.         <icon>0</icon>
  35.         <textAlign>center</textAlign>
  36.         <font>Helvetica</font>
  37.         <textSize>10</textSize>
  38.         <textStyle>bold</textStyle>
  39.         <name>Read aete</name>
  40.         <script>On MouseWithin
  41. ShowBalloon "Click here to read the aete resource of an application to generate glue routines for it."
  42. End MouseWithin
  43.  
  44. on mouseUp
  45. put MergeAete() into aete
  46. if aete is empty then
  47. answer "Unable to read the aete" with "Cancel"
  48. else
  49. AEStopTargeting
  50. put line 1 of aete into field targetApp
  51. AEStartTargeting line 1 of aete,"NoLaunch"
  52. set cursor to watch
  53. put "" into sampleCode
  54. put "" into field "eventList"
  55. put "" into field "myMsgBox"
  56. put "" into elementList
  57. put "" into enumInfo
  58. put "" into classNameList
  59. put "" into keyFormList
  60. put "" into hierarchyList
  61. put "" into compareList
  62. put line 8 of aete into suiteCount
  63. put 8 into linesRead
  64. repeat suiteCount times
  65. set cursor to busy
  66. put line linesRead+6 of aete into eventCount
  67. add 6 to linesRead
  68. repeat eventCount times
  69. set cursor to busy
  70. put line linesRead+11 of aete into paramCount
  71. add paramCount*5+11 to linesRead -- skip extra param
  72. end repeat -- for every event
  73. put line linesRead+1 of aete into classCount
  74. add 1 to linesRead
  75. repeat with classIndex = 1 to classCount
  76. set cursor to busy
  77. put (line linesRead+2 of aete) & "," & StripSp(line linesRead+1 of aete) after classNameList
  78. put (line linesRead+2 of aete) after hierarchyList
  79. put line linesRead+4 of aete into propCount
  80. --add propCount * 5 + 5 to linesRead -- skip prop
  81. add 5 to linesRead
  82. repeat with propIndex = 1 to propCount
  83. set cursor to busy
  84. put "," & (line linesRead of aete) & "," & (line linesRead+1 of aete) after classNameList
  85. add 5 to linesRead
  86. end repeat
  87. put return after classNameList
  88. put line linesRead of aete into elemCount
  89. repeat with elemIndex = 1 to elemCount
  90. set cursor to busy
  91. put line linesRead+1 of aete into elementClass
  92. put "," & elementClass after hierarchyList
  93. put line linesRead+2 of aete into keyFormCount
  94. add 2 to linesRead
  95. put number of lines in elementList into jCount
  96. put 0 into thisElementIndex
  97. repeat with j = 1 to jCount
  98. set cursor to busy
  99. if elementClass = item 1 of line j of elementList then
  100. put j into thisElementIndex
  101. exit repeat
  102. end if
  103. end repeat
  104. if thisElementIndex = 0 then -- add an new item
  105. put elementClass & return after elementList
  106. put jCount+1 into thisElementIndex
  107. end if
  108. repeat with keyFormIndex = 1 to keyFormCount
  109. set cursor to busy
  110. add 1 to linesRead
  111. put ResType(line linesRead of aete) into thisKeyForm
  112. put thisKeyForm after hierarchyList
  113. if offset("," & thisKeyForm, line thisElementIndex of elementList) = 0 then
  114. put "," & thisKeyForm after line thisElementIndex of elementList
  115. end if
  116. end repeat
  117. end repeat -- for every element
  118. put return after hierarchyList
  119. end repeat -- for every class
  120. add 1 to linesRead
  121. put line linesRead of aete into compareCount
  122. add 1 to linesRead
  123. repeat compareCount times
  124. set cursor to busy
  125. put ResType(line linesRead+1 of aete) & "," after compareList
  126. put StripSP(line linesRead+2 of aete) & "Test" into thisName
  127. put "Function " & thisName & " Obj1, obj2" & return after sampleCode
  128. put "  return AECompareSpec(" & quote & line linesRead+1 of aete ¬¨
  129. & quote & ", obj1, obj2)" & return after sampleCode
  130. put "End " & thisName & return & return after sampleCode
  131. add 3 to linesRead
  132. end repeat
  133. put line linesRead of aete into enumerationCount
  134. repeat enumerationCount times
  135. set cursor to busy
  136. put line linesRead+1 of aete into x
  137. put (x = "kfrm") into forKeyForm
  138. put line linesRead+2 of aete into enumeratorCount
  139. add 2 to linesRead
  140. repeat with enumeratorIndex = 1 to enumeratorCount
  141. set cursor to busy
  142. put "," & (line linesRead+1 of aete) & "," & (line linesRead+2 of aete) after x
  143. add 3 to linesRead
  144. end repeat -- for every enumerators
  145. put x & return after enumInfo
  146. if forKeyForm then
  147. delete item 1 of x
  148. put x into keyFormList
  149. end if
  150. end repeat
  151. end repeat
  152. If keyFormList = "" then
  153. put "Index,indx,Named,name,ID,id  " into keyFormList
  154. end if
  155. put MakePickClassName(classNameList) after sampleCode
  156. put classNameList into field "classNameList"
  157. put hierarchyList into field "hierarchyList"
  158. put keyFormList into field "keyFormList"
  159. put compareList into field "compareList"
  160. put ClassSample(elementList, classNameList, keyFormList) after sampleCode
  161. put 8 into linesRead
  162. repeat suiteCount times
  163. set cursor to busy
  164. put line linesRead+3 of aete into suiteCode
  165. put line linesRead+1 of aete into suiteName
  166. put line linesRead+2 of aete into suiteComment
  167. put line linesRead+6 of aete into eventCount
  168. add 6 to linesRead
  169. repeat eventCount times
  170. set cursor to busy
  171. put "" into paramInfo
  172. put line linesRead+1 of aete into eventName
  173. put line linesRead+2 of aete into eventComment
  174. put line linesRead+3 of aete into eventClass
  175. put line linesRead+4 of aete into eventID
  176. put ",," into x -- put in the reply
  177. put line linesRead+5 of aete into item 3 of x
  178. put line linesRead+7 of aete into item 4 of x
  179. put line linesRead+6 of aete into item 5 of x
  180. put x into line 1 of paramInfo
  181. put ",," into x -- put in the direct parameters
  182. put line linesRead+8 of aete into item 3 of x
  183. put line linesRead+10 of aete into item 4 of x
  184. put line linesRead+9 of aete into item 5 of x
  185. put x into line 2 of paramInfo
  186. put line linesRead+11 of aete into paramCount
  187. add 11 to linesRead
  188. repeat with paramIndex = 1 to paramCount
  189. set cursor to busy
  190. put "" into x
  191. put line linesRead+1 of aete into item 1 of x
  192. put line linesRead+2 of aete into item 2 of x
  193. put line linesRead+3 of aete into item 3 of x
  194. put line linesRead+5 of aete into item 4 of x
  195. put line linesRead+4 of aete into item 5 of x
  196. add 5 to linesRead
  197. put x into line (paramIndex+2) of paramInfo
  198. end repeat
  199. put EventSample(eventName, ResType(eventClass), ResType(eventID), paramInfo, enumInfo) after sampleCode
  200. HyperTalkTemplate eventName, eventComment, paramInfo, enumInfo
  201. end repeat -- for every event
  202. put line linesRead+1 of aete into classCount
  203. add 1 to linesRead
  204. repeat with classIndex = 1 to classCount
  205. set cursor to busy
  206. put line linesRead+4 of aete into propCount
  207. add propCount * 5 + 5 to linesRead -- skip prop
  208. put line linesRead of aete into elemCount
  209. repeat with elemIndex = 1 to elemCount
  210. put line linesRead+2 of aete into keyFormCount
  211. add keyFormCount + 2 to linesRead -- skip key Form
  212. end repeat -- for every element
  213. end repeat -- for every class
  214. add 1 to linesRead
  215. put line linesRead of aete into compareCount
  216. add compareCount*3+1 to linesRead -- skip compare
  217. put line linesRead of aete into enumerationCount
  218. repeat enumerationCount times
  219. set cursor to busy
  220. put line linesRead+2 of aete into enumeratorCount
  221. add enumeratorCount*3+2 to linesRead -- skip enumerators
  222. end repeat
  223. end repeat
  224. CmdOrObjButton
  225. if length(sampleCode) < 32000 then
  226. set script of this card to sampleCode
  227. else
  228. ask file "Script is too big, save to file?"
  229. if it <> "" then
  230. put it into ref
  231. open file ref
  232. write sampleCode to file ref
  233. close file ref
  234. end if
  235. end if
  236. end if
  237. end mouseUp
  238.  
  239. function EventSample eventName, eventClass, eventID, paramInfo, enumInfo
  240. put -1 into defaultTimeOut
  241. put field "targetApp" into defaultTarget
  242. put char 1 to 2 of eventName into x
  243. if (x = "#*") or (x = "#$") then
  244. put "*" into defaultTarget
  245. end if
  246. put "AE" & StripSP(EventName) into EventName
  247. put (item 3 of paramInfo <> "null") into isFunc
  248. if isFunc then
  249. put "Function" into header
  250. else
  251. put "On" into header
  252. end if
  253. put space & EventName after header
  254. put space & NumToChar(194) & return into cont
  255. put "  put " & quote & "AESend " & quote & " & quote & " & quote & eventClass & eventID & quote & " & quote & " & quote & "," & quote & cont after sendHeader
  256. put "  & quote & " & quote & defaultTarget & quote & " & quote & " & quote & "," & quote & cont after sendHeader
  257. put "  & " & quote after sendHeader
  258. put "  AESend " & quote & eventClass & eventID & quote & "," ¬¨
  259. & quote & defaultTarget & quote & "," into shortHeader
  260. if isFunc then
  261. put "3," after sendHeader
  262. put "3," after shortHeader
  263. else
  264. put "1," after sendHeader
  265. put "1," after shortHeader
  266. end if
  267. put defaultTimeOut & quote after sendHeader
  268. put defaultTimeOut after shortHeader
  269. put line 2 of paramInfo into x
  270. put (item 3 of x <> "null") into hasDirect
  271. put (item 4 of x > 32767) into directOptional
  272. put 1 into paramIndex
  273. put false into hasOptional
  274. put number of lines in paramInfo into count
  275. repeat with index = 2 to count
  276. set cursor to busy
  277. put line index of paramInfo into x
  278. put item 4 of x into temp
  279. put (temp > 32767) into isOptional
  280. if item 3 of x <> "null" then
  281. if isOptional then
  282. if index <> 2 then
  283. put true into hasOptional
  284. end if
  285. else
  286. put temp div 8192 into temp
  287. put (temp mod 2) = 1 into isEnum
  288. if index = 2 then
  289. -- first parameter is the direct parameter
  290. if paramIndex = 1 then
  291. put " " after header
  292. else
  293. put "," after header
  294. end if
  295. put "directParam" after header
  296. put "----" into item 2 of x
  297. put HTKeyWord(x) into thisType
  298. if length(thisType) > 4 then
  299. -- we need a keyword for directParam because there is a type
  300. put " & " & quote & "," & quote & " & quote & " & quote & thisType & quote & " & quote " after sendHeader
  301. put "," & quote & thisType & quote after shortHeader
  302. if char 5 to 8 of thisType = "enum" then
  303. put EnumLines(enumInfo, 1,item 3 of x, "directParam", true) after rst
  304. end if
  305. end if
  306. put " & " & quote & ",directParam" & quote after sendHeader
  307. put ",directParam" after shortHeader
  308. add 1 to paramIndex
  309. else
  310. put StripSP(item 1 of x) into temp
  311. if paramIndex = 1 then
  312. put " " after header
  313. else
  314. put "," after header
  315. end if
  316. put temp after header
  317. -- put in the keyword
  318. put HTKeyWord(x) into thisType
  319. if (temp = "class") and (item 3 of x = "type") then
  320. put "PickClassName(" & temp & ")" into temp
  321. end if
  322. put " & " & quote & "," & quote & " & quote & " & quote ¬¨
  323. & thisType & quote & " & quote & " & quote & "," & temp & quote after sendHeader
  324. put "," & quote & thisType & quote & "," & temp after shortHeader
  325. if char 5 to 8 of thisType = "enum" then
  326. put EnumLines(enumInfo, 1,item 3 of x, temp, true) after rst
  327. end if
  328. add 1 to paramIndex
  329. end if
  330. end if
  331. end if
  332. end repeat -- 2 to n
  333. if (hasOptional) or (hasDirect and directOptional) then -- not all param are required
  334. put header & return & sendHeader & " after stmt" & return before rst
  335. if hasDirect and directOptional then
  336. put "  put " & paramIndex & " into i" & return after rst
  337. -- we have a optional direct parameter
  338. put "  if (the ParamCount" after rst
  339. if paramIndex > 1 then put space & "- " & paramIndex-1 after rst
  340. put ") mod 2 = 1 then" & return after rst
  341. put line 2 of paramInfo into x
  342. put "----" into item 2 of x
  343. put HTKeyWord(x) into thisType
  344. put false into paramIsUp -- we have not put Param up yet
  345. if (paramIndex > 1) or (length(thisType) > 4) then
  346. -- we have to fake a keyword
  347. put "    put " & quote & "," & quote & " & quote & " & quote & thisType & quote & " & quote after stmt" & return after rst
  348. if char 5 to 8 of thisType = "enum" then
  349. put EnumLines(enumInfo, 2, item 3 of x, "Param(i)", false) into temp
  350. if temp <> "" then
  351. put "    put " & quote & "," & quote & " after stmt" & return after rst
  352. put "    else" into last line of temp
  353. put "      put " & quote & "Param(" & quote & " & i & " & quote & ")" & quote & " after stmt" & return after temp
  354. put "    end if" & return after temp
  355. put temp after rst
  356. put true into paramIsUp -- now we have put Param up
  357. end if
  358. end if
  359. end if
  360. if not paramIsUp then
  361. put "    put " & quote & ",Param(" & quote & " & i & " & quote & ")" & quote & " after stmt" & return after rst
  362. end if
  363. if hasOptional then
  364. -- increment i if we need it later
  365. put "    add 1 to i" & return after rst
  366. end if
  367. put "  end if" & return after rst
  368. else if hasOptional then
  369. put "  put " & paramIndex & " into i" & return after rst
  370. end if
  371. put true into firstOptional
  372. if hasOptional then
  373. put "  repeat until i > the ParamCount" & return after rst
  374. put "    put param(i) into x" & return after rst
  375. put "    put " & quote & "," & quote & " after stmt" & return after rst
  376. put false into hasEnum
  377. repeat with i = 3 to count
  378. set cursor to busy
  379. put line i of paramInfo into x
  380. put item 4 of x into temp
  381. put (temp > 32767) into isOptional
  382. if isOptional then
  383. if firstOptional then
  384. put "    " after rst
  385. put false into firstOptional
  386. else
  387. put "    else " after rst
  388. end if
  389. put HTKeyWord(x) into thisKey
  390. put item 1 of x into thisName
  391. put StripSP(thisName) into noSpName
  392. put (char 5 to 8 of thisKey = "enum") into isEnum
  393. put "if x = " & quote & thisName & quote after rst
  394. if thisName <> noSpName then
  395. put " or x = " & quote & noSpName & quote after rst
  396. end if
  397. if isEnum and (item 2 of x <> noSpName) then
  398. put " or x = " & quote & item 2 of x & quote after rst
  399. end if
  400. put " then" & return after rst
  401. put "      put quote & " & quote & thisKey & quote & " & quote & " & quote & "," & quote & " after stmt" & return after rst
  402. if isEnum then
  403. put true into hasEnum
  404. put EnumLines(enumInfo, 3, item 3 of x, "x", false) into temp
  405. if temp <> "" then
  406. put "      put param(i+1) into x" & return after rst
  407. put temp after rst
  408. end if
  409. end if
  410. end if
  411. end repeat
  412. put "    else" & return after rst
  413. put "      put " & quote & "Param(" & quote & " & i & " & quote & ")," & quote & " after stmt" & return after rst
  414. put "    end if" & return after rst
  415. if hasEnum then
  416. put "    if last char of stmt = " & quote & "," & quote & " then" & return after rst
  417. put "      put " & quote & "Param(" & quote & " & i+1 & " & quote & ")" & quote & " after stmt" & return after rst
  418. put "    end if" & return after rst
  419. else
  420. put "    put " & quote & "Param(" & quote & " & i+1 & " & quote & ")" & quote & " after stmt" & return after rst
  421. end if
  422. put "    add 2 to i" & return after rst
  423. put "  end repeat" & return after rst
  424. end if
  425. put "  do stmt" & return after rst
  426. else -- all are required
  427. put header & return before rst
  428. put shortHeader & return after rst
  429. end if
  430. put "  if the result is not empty then AEHandleError " & quote ¬¨
  431. & EventName & " error : " & quote & " & the Result" after rst
  432. if isFunc then
  433. put " else return it" after rst
  434. end if
  435. put return & "End " & EventName & return & return after rst
  436. return rst
  437. end EventSample
  438.  
  439. function ClassSample elementList, classNameList, keyFormList
  440. put "" into rst
  441. -- we create the glue routine for the object specifiers
  442. put number of lines in elementList into elementCount
  443. put number of items in keyFormList into nameCount
  444. put number of lines in classNameList into classCount
  445. repeat with i = 1 to elementCount
  446. set cursor to busy
  447. put line i of elementList into x
  448. put item 1 of x into classID
  449. put number of items in x into formsPlus1
  450. repeat with j = 1 to classCount -- find the name
  451. set cursor to busy
  452. if classID = item 1 of line j of classNameList then
  453. put item 2 of line j of classNameList & "Object" into thisName
  454. put "function " & thisName & " form,data,container" & return after rst
  455. put "whose" into formChoice
  456. put "  if form = " & quote & "whose" & quote & " then" & return after rst
  457. put "    put " & quote & "test" & quote & " into form" & return after rst
  458. repeat with k = 2 to formsPlus1
  459. set cursor to busy
  460. put item k of x into nameForm
  461. put 2 into kk
  462. repeat while kk <= nameCount
  463. set cursor to busy
  464. if nameForm = item kk of keyFormList then
  465. put "|" & item (kk-1) of keyFormList after formChoice
  466. put "  else if form = " & quote & item (kk-1) of keyFormList & quote & " then" & return after rst
  467. put "    put " & quote & nameForm & quote & " into form" & return after rst
  468. exit repeat
  469. end if
  470. add 2 to kk
  471. end repeat
  472. end repeat
  473. put thisName & "(" after field "eventList"
  474. put length of field "eventList" + 1 into groupBegin
  475. put "{" & formChoice & "}" after field "eventList"
  476. put length of field "eventList" into groupEnd
  477. put ", data, container)" & return & return after field "eventList"
  478. set textstyle of char groupBegin to groupEnd of field "eventList" to group
  479. put "  end if" & return after rst
  480. put "  return AEObjectSpec(" & quote & classID & quote & ",form,data,container)" & return after rst
  481. put "end " & thisName & return & return after rst
  482. -- now do property
  483. put line j of classNameList into x
  484. put item 2 of x & "Property" into thisProp
  485. put number of items in x into k
  486. put 3 into kk
  487. put "function " & thisProp & " property,form,data,container" & return after rst
  488. put thisProp & "(" after field "eventList"
  489. put "{" into tempHeader
  490. repeat while kk < k
  491. set cursor to busy
  492. if kk = 3 then
  493. put "  if" after rst
  494. else
  495. put "  else if" after rst
  496. end if
  497. if kk <> 3 then
  498. put "|" after tempHeader
  499. end if
  500. put item kk of x after tempHeader
  501. put " property = " & quote & item kk of x & quote & " then" & return after rst
  502. put "    put " & quote & item (kk+1) of x & quote & " into property" & return after rst
  503. add 2 to kk
  504. end repeat
  505. put "  end if" & return after rst
  506. put length of field "eventList" + 1 into groupBegin
  507. put tempHeader & "}" after field "eventList"
  508. put length of field "eventList" into groupEnd
  509. put ", " after field "eventList"
  510. set textstyle of char groupBegin to groupEnd of field "eventList" to group
  511. put length of field "eventList" + 1 into groupBegin
  512. put "{" & formChoice & "}" after field "eventList"
  513. put length of field "eventList" into groupEnd
  514. put ", data, container)" & return & return after field "eventList"
  515. set textstyle of char groupBegin to groupEnd of field "eventList" to group
  516. put "  return AEObjectSpec(" & quote & "prop" & quote & ", " ¬¨
  517. & quote & "prop" & quote & ", property, " & thisName ¬¨
  518. & "(form,data,container))" & return after rst
  519. put "end " & thisProp & return & return after rst
  520. exit repeat
  521. end if
  522. end repeat
  523. end repeat
  524. return rst
  525. end ClassSample
  526.  
  527. function EnumLines enumInfo, indent, enumCode, varName, writeToVar
  528. repeat indent times
  529. set cursor to busy
  530. put "  " after indentSpace
  531. end repeat
  532. put "" into rst
  533. put number of lines in enumInfo into enumCount
  534. repeat with enumIndex = 1 to enumCount
  535. set cursor to busy
  536. if item 1 of line enumIndex of enumInfo = enumCode then
  537. put line enumIndex of enumInfo into x
  538. put (number of items in x - 1) div 2 into n
  539. if n > 0 then
  540. -- now we go through the enum list and check each one
  541. put 2 into j
  542. repeat with i = 1 to n
  543. set cursor to busy
  544. if i = 1 then
  545. put indentSpace & "if" after rst
  546. else
  547. put indentSpace & "else if" after rst
  548. end if
  549. put space & varName & " = " & quote & item j of x & quote & " then" & return after rst
  550. if writeToVar then
  551. put indentSpace & "  put " & quote & ResType(item j+1 of x) & quote & " into " & varName & return after rst
  552. else
  553. put indentSpace & "  put quote & " & quote & ResType(item j+1 of x) & quote & " & quote after stmt" & return after rst
  554. end if
  555. add 2 to j
  556. end repeat
  557. put indentSpace & "end if" & return after rst
  558. end if -- if n > 0
  559. put enumCount+1 into enumIndex
  560. end if
  561. end repeat
  562. return rst
  563. end EnumLines
  564.  
  565. function StripSP x, lowerCase
  566. put char 1 to 2 of x into y
  567. if (y = "#&") or (y = "#*") then
  568. delete char 1 to 2 of x -- it just means it is from AEUT
  569. end if
  570. put CharToNum(char 1 of x) into n
  571. if lowerCase = true then
  572. if (n >= 65) and (n <= 90) then
  573. put NumToChar(n+32) into char 1 of x
  574. end if
  575. else
  576. if (n >= 97) and (n <= 122) then
  577. put NumToChar(n-32) into char 1 of x
  578. end if
  579. end if
  580. repeat until i = 0
  581. set cursor to busy
  582. put offset(space, x) into i
  583. if i > 0 then
  584. put CharToNum(char (i+1) of x) into n
  585. if (n >= 97) and (n <= 122) then
  586. put NumToChar(n-32) into char (i+1) of x
  587. end if
  588. delete char i of x
  589. end if
  590. end repeat
  591. return x
  592. end StripSP
  593.  
  594. function HTKeyWord info
  595. put ((item 4 of info) div 8192) mod 4 into temp
  596. if temp > 1 then
  597. put "list" into thisType
  598. else if temp = 1 then
  599. put "enum" into thisType
  600. else
  601. put ResType(item 3 of info) into thisType
  602. end if
  603. -- if it is a special type, we need to append type after keyword
  604. if (thisType = "TEXT") OR (thisType = "obj ") OR (thisType = "list") or (thisType = "null") then
  605. return item 2 of info
  606. else
  607. return ResType(item 2 of info) & ThisType
  608. end if
  609. end HTKeyWord
  610.  
  611. function ResType x
  612. return char 1 to 4 of (x & "    ")
  613. end ResType
  614.  
  615. On HyperTalkTemplate eventName, eventComment, paramInfo, enumInfo
  616. put quote & "----" & quote into dash
  617. put (item 3 of line 1 of paramInfo <> "null") into isFunc
  618. put 0 into paramIndex
  619. put number of lines in paramInfo into n
  620. -- either return the template or which parameter is being clicked
  621. put "" into paramComment
  622. put "AE" & StripSP(eventName) into template
  623. if isFunc then
  624. put " (" after template
  625. else
  626. put space after template
  627. end if
  628. put "" into paramDelim
  629. put true into firstTime -- no comma before first param
  630. put 1 into optionEnd -- we loop twice, once for required once for optional
  631. -- we loop through it twice, on time for required, one for opt
  632. repeat with option = 0 to optionEnd
  633. set cursor to busy
  634. put (option = 1) into wantOptional
  635. repeat with index = 2 to n
  636. set cursor to busy
  637. put line index of paramInfo into y
  638. put item 4 of y into temp
  639. put (temp > 32767) into isOptional
  640. if (isOptional = wantOptional) then
  641. put temp div 8192 into temp
  642. put (temp mod 2 = 1) into isEnum
  643. put true into useIt
  644. if index = 2 then
  645. if item 3 of y = "null" then put false into useIt
  646. put "directParam" into item 1 of y
  647. put "----" into item 2 of y
  648. end if
  649. if useIt then
  650. add 1 to paramIndex
  651. if useIt then
  652. if item 5 of y <> "" then
  653. put y into thisComment
  654. delete item 1 to 4 of thisComment
  655. put "--  " & item 1 of y & ": " & thisComment & return after paramComment
  656. end if
  657. if isOptional then
  658. put " [" after template
  659. put "o," & length of template & "," after paramDelim
  660. else
  661. put space after template
  662. end if
  663. if (index <> 2) and isOptional then
  664. if firstTime then
  665. put false into firstTime
  666. else
  667. put "," after template
  668. end if
  669. put item 1 of y into thisKey
  670. put quote & thisKey & quote after template
  671. end if
  672. if firstTime then
  673. put false into firstTime
  674. else
  675. put "," after template
  676. end if
  677. if isOptional then
  678. if item 3 of y = "true" then
  679. put "true" after template
  680. else if isEnum then
  681. put EnumOption(enumInfo,item 3 of y) after template
  682. else if (item 1 of y = "Class") and (item 3 of y = "type") then
  683. put ClassList() after template
  684. else
  685. put "some" & item 3 of y after template
  686. end if
  687. put "]" after template
  688. put (length of template) & "," after paramDelim
  689. else
  690. if isEnum then
  691. put "r," & length of template + 1 & "," after paramDelim
  692. put EnumOption(enumInfo,item 3 of y) after template
  693. put (length of template) & "," after paramDelim
  694. else if (item 1 of y = "Class") and (item 3 of y = "type") then
  695. put "r," & length of template + 1 & "," after paramDelim
  696. put ClassList() after template
  697. put (length of template) & "," after paramDelim
  698. else
  699. put item 1 of y after template
  700. end if
  701. end if
  702. end if
  703. end if -- useit
  704. end if -- the right kind of option
  705. end repeat
  706. end repeat
  707. if isFunc then
  708. put " )" after template
  709. end if
  710. put return after template
  711. if eventComment <> "" then
  712. put "-- " & eventComment & return after template
  713. end if
  714. put paramComment & return after template
  715. put length of field "eventList" into orgSize
  716. put template after field "eventList"
  717. put 1 into i
  718. put number of items in paramDelim into n
  719. repeat until i >= n
  720. set cursor to busy
  721. if item i of paramDelim = "o" then
  722. put "italic,group" into styl
  723. else
  724. put "group" into styl
  725. end if
  726. set textstyle of char (orgSize + item i+1 of paramDelim) to ¬¨
  727. (orgSize + item i+2 of paramDelim) of field "eventList" to styl
  728. add 3 to i
  729. end repeat
  730. end HyperTalkTemplate
  731.  
  732. function EnumOption enumInfo,enumeration
  733. put "" into theList
  734. put number of lines in enumInfo into enumCount
  735. repeat with enumIndex = 1 to enumCount
  736. set cursor to busy
  737. if item 1 of line enumIndex of enumInfo = enumeration then
  738. put line enumIndex of enumInfo into x
  739. put (number of items in x - 1) div 2 into n
  740. if n > 0 then
  741. -- now we go through the enum list and check each one
  742. put "{" & item 2 of x into theList
  743. put 4 into j
  744. repeat with i = 2 to n
  745. set cursor to busy
  746. put "|" & item j of x after theList
  747. add 2 to j
  748. end repeat
  749. put "}" after theList
  750. end if -- if n > 0
  751. return theList
  752. end if
  753. end repeat
  754. end EnumOption
  755.  
  756. function ClassList
  757. put field "classNameList" into classNameList
  758. put number of lines in classNameList into n
  759. put "{" into x
  760. repeat with i = 1 to n
  761. if i <> 1 then put "|" after x
  762. put item 2 of line i of classNameList after x
  763. end repeat
  764. return x & "}"
  765. end ClassList
  766.  
  767. function MakePickClassName classNameList
  768. put "function PickClassName className" & return into rst
  769. if classNameList = "" then
  770. put "return className" & return after rst
  771. else
  772. put number of lines in classNameList into n
  773. repeat with i = 1 to n
  774. put "if className = " & quote & item 2 of line i of classNameList ¬¨
  775. & quote & " then" & return & "return " & quote ¬¨
  776. & item 1 of line i of classNameList & quote & return & "else " after rst
  777. end repeat
  778. put return & "return className" & return & "end if" & return into last char of rst
  779. end if
  780. return rst & "end PickClassName" & return & return
  781. end MakePickClassName</script>
  782.     </part>
  783.     <part>
  784.         <id>2</id>
  785.         <type>button</type>
  786.         <visible> <true /> </visible>
  787.         <reserved5> 0 </reserved5>
  788.         <reserved4> 0 </reserved4>
  789.         <reserved3> 0 </reserved3>
  790.         <reserved2> 0 </reserved2>
  791.         <reserved1> 0 </reserved1>
  792.         <enabled> <true /> </enabled>
  793.         <rect>
  794.             <left>409</left>
  795.             <top>23</top>
  796.             <right>485</right>
  797.             <bottom>42</bottom>
  798.         </rect>
  799.         <style>shadow</style>
  800.         <showName> <true /> </showName>
  801.         <highlight> <false /> </highlight>
  802.         <autoHighlight> <true /> </autoHighlight>
  803.         <sharedHighlight> <true /> </sharedHighlight>
  804.         <family>0</family>
  805.         <titleWidth>0</titleWidth>
  806.         <icon>0</icon>
  807.         <textAlign>center</textAlign>
  808.         <font>Helvetica</font>
  809.         <textSize>10</textSize>
  810.         <textStyle>bold</textStyle>
  811.         <name>Launch App</name>
  812.         <script>On MouseWithin
  813. ShowBalloon "Click here to launch this application."
  814. End MouseWithin
  815.  
  816. on mouseUp
  817. HMRemoveBalloon
  818. open field "targetApp"
  819. end mouseUp
  820.  
  821. on xmouseUp
  822. if the optionKey is down then
  823. open field "targetApp"
  824. else
  825. answer program "send to which program"
  826. if it <> "" then
  827. Set the itemDelimiter to ":"
  828. put it into x
  829. delete last item of x
  830. put the address into y
  831. delete last item of y
  832. if x = y then
  833. delete item 1 to 2 of it
  834. end if
  835. put it into x
  836. Set the itemDelimiter to ","
  837. StopTargeting
  838. put x into field "targetApp"
  839. AEStartTargeting x,"NoLaunch"
  840. else if the optionKey is down then
  841. open field "targetApp"
  842. end if
  843. end if
  844. end xmouseUp</script>
  845.     </part>
  846.     <part>
  847.         <id>3</id>
  848.         <type>field</type>
  849.         <visible> <true /> </visible>
  850.         <dontWrap> <false /> </dontWrap>
  851.         <dontSearch> <false /> </dontSearch>
  852.         <sharedText> <false /> </sharedText>
  853.         <fixedLineHeight> <false /> </fixedLineHeight>
  854.         <autoTab> <false /> </autoTab>
  855.         <lockText> <true /> </lockText>
  856.         <rect>
  857.             <left>8</left>
  858.             <top>25</top>
  859.             <right>289</right>
  860.             <bottom>46</bottom>
  861.         </rect>
  862.         <style>transparent</style>
  863.         <autoSelect> <false /> </autoSelect>
  864.         <showLines> <false /> </showLines>
  865.         <wideMargins> <false /> </wideMargins>
  866.         <multipleLines> <false /> </multipleLines>
  867.         <reservedFamily> 0 </reservedFamily>
  868.         <titleWidth>0</titleWidth>
  869.         <icon>0</icon>
  870.         <textAlign>left</textAlign>
  871.         <font>Helvetica</font>
  872.         <textSize>18</textSize>
  873.         <textStyle>bold</textStyle>
  874.         <textHeight>24</textHeight>
  875.         <name>targetApp</name>
  876.         <script>-- On MouseWithin
  877. -- ShowBalloon "The Apple Events routines displayed on this card is for this application."
  878. -- End MouseWithin
  879. </script>
  880.     </part>
  881.     <part>
  882.         <id>5</id>
  883.         <type>field</type>
  884.         <visible> <true /> </visible>
  885.         <dontWrap> <false /> </dontWrap>
  886.         <dontSearch> <false /> </dontSearch>
  887.         <sharedText> <false /> </sharedText>
  888.         <fixedLineHeight> <false /> </fixedLineHeight>
  889.         <autoTab> <false /> </autoTab>
  890.         <lockText> <false /> </lockText>
  891.         <rect>
  892.             <left>8</left>
  893.             <top>256</top>
  894.             <right>461</right>
  895.             <bottom>337</bottom>
  896.         </rect>
  897.         <style>scrolling</style>
  898.         <autoSelect> <false /> </autoSelect>
  899.         <showLines> <false /> </showLines>
  900.         <wideMargins> <false /> </wideMargins>
  901.         <multipleLines> <false /> </multipleLines>
  902.         <reservedFamily> 0 </reservedFamily>
  903.         <titleWidth>0</titleWidth>
  904.         <icon>0</icon>
  905.         <textAlign>left</textAlign>
  906.         <font>Monaco</font>
  907.         <textSize>9</textSize>
  908.         <textStyle>plain</textStyle>
  909.         <textHeight>12</textHeight>
  910.         <name>myMsgBox</name>
  911.         <script>On MouseWithin
  912. put CharToNum(char 1 of me) into x
  913. if ((char 1 of me) = (char 6 of me)) and ((x = 174) or (x = 190)) then
  914. ShowBalloon me
  915. else
  916. ShowBalloon "Apple Events commands can be sent from this field. Click the " & quote & "Do It" ¬¨
  917. & quote & "button to the right to execute the content of this field."
  918. end if
  919. End MouseWithin
  920. </script>
  921.     </part>
  922.     <part>
  923.         <id>6</id>
  924.         <type>button</type>
  925.         <visible> <true /> </visible>
  926.         <reserved5> 0 </reserved5>
  927.         <reserved4> 0 </reserved4>
  928.         <reserved3> 0 </reserved3>
  929.         <reserved2> 0 </reserved2>
  930.         <reserved1> 0 </reserved1>
  931.         <enabled> <true /> </enabled>
  932.         <rect>
  933.             <left>466</left>
  934.             <top>321</top>
  935.             <right>509</right>
  936.             <bottom>340</bottom>
  937.         </rect>
  938.         <style>shadow</style>
  939.         <showName> <true /> </showName>
  940.         <highlight> <false /> </highlight>
  941.         <autoHighlight> <true /> </autoHighlight>
  942.         <sharedHighlight> <false /> </sharedHighlight>
  943.         <family>0</family>
  944.         <titleWidth>0</titleWidth>
  945.         <icon>0</icon>
  946.         <textAlign>center</textAlign>
  947.         <font>Helvetica</font>
  948.         <textSize>12</textSize>
  949.         <textStyle>bold</textStyle>
  950.         <name>obj</name>
  951.         <script>on MouseUp
  952. if short name of target = "Obj" then
  953. set name of target to "Cmd"
  954. Hide field "eventList"
  955. StartChunkExpr
  956. else
  957. if the optionKey is down then
  958. StartChunkExpr
  959. else
  960. set name of target to "Obj"
  961. put "1. Click parameters to select them.   2. Then click handler names to copy them to the messages field below:" into field "operation"
  962. Show field "eventList"
  963. end if
  964. end if
  965. HMRemoveBalloon
  966. end mouseUp
  967.  
  968. on mouseEnter
  969. global myMsgBoxSelection
  970. put the selectedChunk into myMsgBoxSelection
  971. end mouseEnter
  972.  
  973. On MouseWithin
  974. if short name of target = "Obj" then
  975. ShowBalloon "Hit this button to generate an object specifier using graphical user interface"
  976. else
  977. ShowBalloon "Hit this button to list the commands you can send, or hit the button with the option key down to restart the object specification"
  978. end if
  979. End MouseWithin
  980. </script>
  981.     </part>
  982.     <part>
  983.         <id>8</id>
  984.         <type>field</type>
  985.         <visible> <false /> </visible>
  986.         <dontWrap> <false /> </dontWrap>
  987.         <dontSearch> <false /> </dontSearch>
  988.         <sharedText> <false /> </sharedText>
  989.         <fixedLineHeight> <false /> </fixedLineHeight>
  990.         <autoTab> <false /> </autoTab>
  991.         <lockText> <false /> </lockText>
  992.         <rect>
  993.             <left>8</left>
  994.             <top>245</top>
  995.             <right>509</right>
  996.             <bottom>276</bottom>
  997.         </rect>
  998.         <style>scrolling</style>
  999.         <autoSelect> <false /> </autoSelect>
  1000.         <showLines> <false /> </showLines>
  1001.         <wideMargins> <false /> </wideMargins>
  1002.         <multipleLines> <false /> </multipleLines>
  1003.         <reservedFamily> 0 </reservedFamily>
  1004.         <titleWidth>0</titleWidth>
  1005.         <icon>0</icon>
  1006.         <textAlign>left</textAlign>
  1007.         <font>Geneva</font>
  1008.         <textSize>12</textSize>
  1009.         <textStyle>plain</textStyle>
  1010.         <textHeight>16</textHeight>
  1011.         <name>chunkExp</name>
  1012.         <script>on MouseWithin
  1013. ShowBalloon "Don't worry about this, it will not be shown in the final version."
  1014. end MouseWithin
  1015. </script>
  1016.     </part>
  1017.     <part>
  1018.         <id>9</id>
  1019.         <type>field</type>
  1020.         <visible> <true /> </visible>
  1021.         <dontWrap> <false /> </dontWrap>
  1022.         <dontSearch> <false /> </dontSearch>
  1023.         <sharedText> <false /> </sharedText>
  1024.         <fixedLineHeight> <false /> </fixedLineHeight>
  1025.         <autoTab> <false /> </autoTab>
  1026.         <lockText> <true /> </lockText>
  1027.         <rect>
  1028.             <left>11</left>
  1029.             <top>48</top>
  1030.             <right>508</right>
  1031.             <bottom>63</bottom>
  1032.         </rect>
  1033.         <style>transparent</style>
  1034.         <autoSelect> <false /> </autoSelect>
  1035.         <showLines> <false /> </showLines>
  1036.         <wideMargins> <false /> </wideMargins>
  1037.         <multipleLines> <false /> </multipleLines>
  1038.         <reservedFamily> 0 </reservedFamily>
  1039.         <titleWidth>0</titleWidth>
  1040.         <icon>0</icon>
  1041.         <textAlign>left</textAlign>
  1042.         <font>Geneva</font>
  1043.         <textSize>9</textSize>
  1044.         <textStyle>plain</textStyle>
  1045.         <textHeight>12</textHeight>
  1046.         <name>operation</name>
  1047.         <script></script>
  1048.     </part>
  1049.     <part>
  1050.         <id>10</id>
  1051.         <type>field</type>
  1052.         <visible> <true /> </visible>
  1053.         <dontWrap> <true /> </dontWrap>
  1054.         <dontSearch> <false /> </dontSearch>
  1055.         <sharedText> <false /> </sharedText>
  1056.         <fixedLineHeight> <false /> </fixedLineHeight>
  1057.         <autoTab> <false /> </autoTab>
  1058.         <lockText> <true /> </lockText>
  1059.         <rect>
  1060.             <left>9</left>
  1061.             <top>62</top>
  1062.             <right>507</right>
  1063.             <bottom>241</bottom>
  1064.         </rect>
  1065.         <style>scrolling</style>
  1066.         <autoSelect> <false /> </autoSelect>
  1067.         <showLines> <false /> </showLines>
  1068.         <wideMargins> <false /> </wideMargins>
  1069.         <multipleLines> <false /> </multipleLines>
  1070.         <reservedFamily> 0 </reservedFamily>
  1071.         <titleWidth>0</titleWidth>
  1072.         <icon>0</icon>
  1073.         <textAlign>left</textAlign>
  1074.         <font>Geneva</font>
  1075.         <textSize>12</textSize>
  1076.         <textStyle>plain</textStyle>
  1077.         <textHeight>16</textHeight>
  1078.         <name>pickList</name>
  1079.         <script>on MouseWithin
  1080. put last item of line 1 of field "cardState" into curState
  1081. if (curState = "pickElem") then
  1082. ShowBalloon "Pick a property or element from the container."
  1083. else if (curState = "pickObj1") then
  1084. ShowBalloon "You are picking an object or property to be used in comparision."
  1085. else if (curState = "pickObj2") then
  1086. ShowBalloon "You are picking another object, property or constant for comparision with the first one."
  1087. else if curState = "pickKeyForm" then
  1088. ShowBalloon "There are many way you can pick an element, please identify one."
  1089. else if curState = "pickCmpr" then
  1090. ShowBalloon "How should the last object compare with the next one?"
  1091. end if
  1092. end MouseWithin
  1093.  
  1094. on MouseUp
  1095. HMRemoveBalloon
  1096. put value of the clickLine into select
  1097. if select = "" then exit MouseUp
  1098. put field "operation" into operation
  1099. put last item of line 1 of field "cardState" into curState
  1100. if (curState = "pickElem") or (curState = "pickObj1") or (curState = "pickObj2") then
  1101. put (last word of select = "property") into isProperty
  1102. put last item of line 2 of field "cardState" into containerCode
  1103. if (select = "constant") and (curState = "pickObj2") then
  1104. ask "compare the value to"
  1105. put "cnstcnst(" & it & ")" after field "chunkExp"
  1106. ChunkComplete
  1107. else if isProperty then
  1108. if curState = "pickObj1" then
  1109. put " " & select after field "operation"
  1110. end if
  1111. delete last word of select
  1112. put PropNameToCode(containerCode, select) & "prop" after field "chunkExp"
  1113. ChunkComplete
  1114. else if last word of select = "itself" then
  1115. if curState = "pickObj1" then
  1116. put " " & select after field "operation"
  1117. end if
  1118. Delete last char of field "chunkExp"
  1119. ChunkComplete
  1120. else
  1121. put ClassNameToCode(select) into classCode
  1122. put classCode after field "chunkExp"
  1123. put classCode into last item of line 2 of field "cardState"
  1124. put "Which" && select into field "operation"
  1125. put KeyFormList(containerCode, classCode) into field "pickList"
  1126. put "pickKeyForm" into last item of line 1 of field "cardState"
  1127. end if
  1128. else if curState = "pickKeyForm" then
  1129. put last item of line 2 of field "cardState" into classCode
  1130. if select = "whose" then
  1131. put "test(" after field "chunkExp"
  1132. put "," & classCode after line 2 of field "cardState"
  1133. MakePickList classCode,"pickObj1"
  1134. else
  1135. ask operation && select
  1136. put KeyFormNameToCode(select) & "(" & it & ")." after field "chunkExp"
  1137. delete last item of line 1 of field "cardState"
  1138. MakePickList classCode,"pickElem"
  1139. end if
  1140. else if curState = "pickCmpr" then
  1141. put " " & select after field "operation"
  1142. put select & "," after field "chunkExp"
  1143. MakePickList last item of line 2 of field "cardState", "pickObj2"
  1144. end if
  1145. end MouseUp
  1146. </script>
  1147.     </part>
  1148.     <part>
  1149.         <id>7</id>
  1150.         <type>field</type>
  1151.         <visible> <false /> </visible>
  1152.         <dontWrap> <true /> </dontWrap>
  1153.         <dontSearch> <false /> </dontSearch>
  1154.         <sharedText> <false /> </sharedText>
  1155.         <fixedLineHeight> <false /> </fixedLineHeight>
  1156.         <autoTab> <false /> </autoTab>
  1157.         <lockText> <false /> </lockText>
  1158.         <rect>
  1159.             <left>155</left>
  1160.             <top>214</top>
  1161.             <right>509</right>
  1162.             <bottom>245</bottom>
  1163.         </rect>
  1164.         <style>scrolling</style>
  1165.         <autoSelect> <false /> </autoSelect>
  1166.         <showLines> <false /> </showLines>
  1167.         <wideMargins> <false /> </wideMargins>
  1168.         <multipleLines> <false /> </multipleLines>
  1169.         <reservedFamily> 0 </reservedFamily>
  1170.         <titleWidth>0</titleWidth>
  1171.         <icon>0</icon>
  1172.         <textAlign>left</textAlign>
  1173.         <font>Geneva</font>
  1174.         <textSize>12</textSize>
  1175.         <textStyle>plain</textStyle>
  1176.         <textHeight>16</textHeight>
  1177.         <name>classNameList</name>
  1178.         <script>on MouseWithin
  1179. ShowBalloon "Don't worry about this, it will not be shown in the final version."
  1180. end MouseWithin
  1181. </script>
  1182.     </part>
  1183.     <part>
  1184.         <id>12</id>
  1185.         <type>field</type>
  1186.         <visible> <false /> </visible>
  1187.         <dontWrap> <true /> </dontWrap>
  1188.         <dontSearch> <false /> </dontSearch>
  1189.         <sharedText> <false /> </sharedText>
  1190.         <fixedLineHeight> <false /> </fixedLineHeight>
  1191.         <autoTab> <false /> </autoTab>
  1192.         <lockText> <false /> </lockText>
  1193.         <rect>
  1194.             <left>154</left>
  1195.             <top>180</top>
  1196.             <right>507</right>
  1197.             <bottom>213</bottom>
  1198.         </rect>
  1199.         <style>scrolling</style>
  1200.         <autoSelect> <false /> </autoSelect>
  1201.         <showLines> <false /> </showLines>
  1202.         <wideMargins> <false /> </wideMargins>
  1203.         <multipleLines> <false /> </multipleLines>
  1204.         <reservedFamily> 0 </reservedFamily>
  1205.         <titleWidth>0</titleWidth>
  1206.         <icon>0</icon>
  1207.         <textAlign>left</textAlign>
  1208.         <font>Geneva</font>
  1209.         <textSize>12</textSize>
  1210.         <textStyle>plain</textStyle>
  1211.         <textHeight>16</textHeight>
  1212.         <name>hierarchyList</name>
  1213.         <script>on MouseWithin
  1214. ShowBalloon "Don't worry about this, it will not be shown in the final version."
  1215. end MouseWithin
  1216. </script>
  1217.     </part>
  1218.     <part>
  1219.         <id>11</id>
  1220.         <type>field</type>
  1221.         <visible> <false /> </visible>
  1222.         <dontWrap> <false /> </dontWrap>
  1223.         <dontSearch> <false /> </dontSearch>
  1224.         <sharedText> <false /> </sharedText>
  1225.         <fixedLineHeight> <false /> </fixedLineHeight>
  1226.         <autoTab> <false /> </autoTab>
  1227.         <lockText> <true /> </lockText>
  1228.         <rect>
  1229.             <left>8</left>
  1230.             <top>84</top>
  1231.             <right>137</right>
  1232.             <bottom>180</bottom>
  1233.         </rect>
  1234.         <style>scrolling</style>
  1235.         <autoSelect> <false /> </autoSelect>
  1236.         <showLines> <false /> </showLines>
  1237.         <wideMargins> <false /> </wideMargins>
  1238.         <multipleLines> <false /> </multipleLines>
  1239.         <reservedFamily> 0 </reservedFamily>
  1240.         <titleWidth>0</titleWidth>
  1241.         <icon>0</icon>
  1242.         <textAlign>left</textAlign>
  1243.         <font>Geneva</font>
  1244.         <textSize>12</textSize>
  1245.         <textStyle>plain</textStyle>
  1246.         <textHeight>16</textHeight>
  1247.         <name>cardState</name>
  1248.         <script>on MouseWithin
  1249. ShowBalloon "Don't worry about this, it will not be shown in the final version."
  1250. end MouseWithin
  1251. </script>
  1252.     </part>
  1253.     <part>
  1254.         <id>14</id>
  1255.         <type>field</type>
  1256.         <visible> <false /> </visible>
  1257.         <dontWrap> <false /> </dontWrap>
  1258.         <dontSearch> <false /> </dontSearch>
  1259.         <sharedText> <false /> </sharedText>
  1260.         <fixedLineHeight> <false /> </fixedLineHeight>
  1261.         <autoTab> <false /> </autoTab>
  1262.         <lockText> <false /> </lockText>
  1263.         <rect>
  1264.             <left>8</left>
  1265.             <top>180</top>
  1266.             <right>155</right>
  1267.             <bottom>213</bottom>
  1268.         </rect>
  1269.         <style>rectangle</style>
  1270.         <autoSelect> <false /> </autoSelect>
  1271.         <showLines> <false /> </showLines>
  1272.         <wideMargins> <false /> </wideMargins>
  1273.         <multipleLines> <false /> </multipleLines>
  1274.         <reservedFamily> 0 </reservedFamily>
  1275.         <titleWidth>0</titleWidth>
  1276.         <icon>0</icon>
  1277.         <textAlign>left</textAlign>
  1278.         <font>Geneva</font>
  1279.         <textSize>12</textSize>
  1280.         <textStyle>plain</textStyle>
  1281.         <textHeight>16</textHeight>
  1282.         <name>keyFormList</name>
  1283.         <script>on MouseWithin
  1284. ShowBalloon "Don't worry about this, it will not be shown in the final version."
  1285. end MouseWithin
  1286. </script>
  1287.     </part>
  1288.     <part>
  1289.         <id>13</id>
  1290.         <type>field</type>
  1291.         <visible> <false /> </visible>
  1292.         <dontWrap> <false /> </dontWrap>
  1293.         <dontSearch> <false /> </dontSearch>
  1294.         <sharedText> <false /> </sharedText>
  1295.         <fixedLineHeight> <false /> </fixedLineHeight>
  1296.         <autoTab> <false /> </autoTab>
  1297.         <lockText> <false /> </lockText>
  1298.         <rect>
  1299.             <left>8</left>
  1300.             <top>212</top>
  1301.             <right>155</right>
  1302.             <bottom>245</bottom>
  1303.         </rect>
  1304.         <style>rectangle</style>
  1305.         <autoSelect> <false /> </autoSelect>
  1306.         <showLines> <false /> </showLines>
  1307.         <wideMargins> <false /> </wideMargins>
  1308.         <multipleLines> <false /> </multipleLines>
  1309.         <reservedFamily> 0 </reservedFamily>
  1310.         <titleWidth>0</titleWidth>
  1311.         <icon>0</icon>
  1312.         <textAlign>left</textAlign>
  1313.         <font>Geneva</font>
  1314.         <textSize>12</textSize>
  1315.         <textStyle>plain</textStyle>
  1316.         <textHeight>16</textHeight>
  1317.         <name>compareList</name>
  1318.         <script>on MouseWithin
  1319. ShowBalloon "Don't worry about this, it will not be shown in the final version."
  1320. end MouseWithin
  1321. </script>
  1322.     </part>
  1323.     <part>
  1324.         <id>4</id>
  1325.         <type>field</type>
  1326.         <visible> <true /> </visible>
  1327.         <dontWrap> <false /> </dontWrap>
  1328.         <dontSearch> <false /> </dontSearch>
  1329.         <sharedText> <false /> </sharedText>
  1330.         <fixedLineHeight> <true /> </fixedLineHeight>
  1331.         <autoTab> <false /> </autoTab>
  1332.         <lockText> <true /> </lockText>
  1333.         <rect>
  1334.             <left>8</left>
  1335.             <top>62</top>
  1336.             <right>507</right>
  1337.             <bottom>241</bottom>
  1338.         </rect>
  1339.         <style>scrolling</style>
  1340.         <autoSelect> <false /> </autoSelect>
  1341.         <showLines> <false /> </showLines>
  1342.         <wideMargins> <false /> </wideMargins>
  1343.         <multipleLines> <false /> </multipleLines>
  1344.         <reservedFamily> 0 </reservedFamily>
  1345.         <titleWidth>0</titleWidth>
  1346.         <icon>0</icon>
  1347.         <textAlign>left</textAlign>
  1348.         <font>Monaco</font>
  1349.         <textSize>9</textSize>
  1350.         <textStyle>plain</textStyle>
  1351.         <textHeight>12</textHeight>
  1352.         <name>EventList</name>
  1353.         <script>on mouseEnter
  1354. global myMsgBoxSelection
  1355. put the selectedChunk into myMsgBoxSelection
  1356. --idleCursor(128)
  1357. end mouseEnter
  1358.  
  1359. --on mouseLeave
  1360. --idleCursor(hand)
  1361. --end mouseLeave
  1362.  
  1363. on mouseUp
  1364. set cursor to watch
  1365. put the clickLine into x
  1366. put word 2 of x into theLine
  1367. put value of x into y
  1368. repeat while char 1 of y = "-"
  1369. subtract 1 from theLine
  1370. put theLine into word 2 of x
  1371. put value of x into y
  1372. end repeat
  1373. put the clickChunk into cc
  1374. put the clickText into cv
  1375. put char 1 of cv into beginChar
  1376. if (beginChar = "[") or (beginChar = "{") then
  1377. if italic is in the textstyle of cc then
  1378. put Offset("{", cv) into enumDelim
  1379. if enumDelim > 0 then
  1380. set lockText of me to false
  1381. click at the clickLoc
  1382. click at the clickLoc
  1383. put the selectedChunk into sc
  1384. set lockText of me to true
  1385. put (((word 2 of sc) - (word 2 of cc)) >= enumDelim) into enumChosen
  1386. if enumChosen then
  1387. put cc into orgCc
  1388. end if
  1389. set textStyle of cc to "plain"
  1390. -- we have a enum, we need to break into 2 groups
  1391. put word 4 of cc into paramEnd
  1392. put word 2 of cc + enumDelim - 3 into word 4 of cc
  1393. set textstyle of cc to "group"
  1394. put (word 4 of cc) + 2 into word 2 of cc
  1395. put paramEnd into word 4 of cc
  1396. set textStyle of cc to "group"
  1397. if enumChosen then
  1398. DoEnumStuff orgCc,sc,cv
  1399. end if
  1400. else -- just enable the whole group
  1401. set textstyle of cc to "plain,group"
  1402. end if
  1403. else if beginChar = "{" then
  1404. -- we have enum choices here
  1405. set lockText of me to false
  1406. click at the clickLoc
  1407. click at the clickLoc
  1408. put the selectedChunk into sc
  1409. set lockText of me to true
  1410. set textstyle of cc to "plain,group"
  1411. DoEnumStuff cc,sc,cv
  1412. else if char (word 4 of cc) of me = "]" then
  1413. set textstyle of cc to "italic,group"
  1414. else -- we need to include the enum again
  1415. put Offset("]", char (word 4 of cc) to (word 2 of cc + 500) of me) into enumDelim
  1416. put (word 4 of cc) + enumDelim - 1 into word 4 of cc
  1417. set textstyle of cc to "italic,group"
  1418. end if
  1419. else if y <> "" then
  1420. put 0 into deleteCount
  1421. put 1 into beginOpt
  1422. repeat until (beginOpt = 0) and (beginEnum = 0)
  1423. -- search for the next optional param
  1424. put offset ("[", y) into beginOpt
  1425. put offset ("{", y) into beginEnum
  1426. if (beginOpt > 0) and ((beginEnum = 0) or (beginOpt < beginEnum)) then
  1427. delete char beginOpt of y
  1428. add 1 to deleteCount
  1429. put (italic is in textstyle of char (beginOpt + deleteCount) of line theLine of me) into dontWant
  1430. put offset ("]", y) into endOpt
  1431. if endOpt > 0 then
  1432. if dontWant then -- if italic we don't want it
  1433. if char endOpt+1 of y = " " then add 1 to endOpt
  1434. delete char beginOpt to endOpt of y
  1435. add (endOpt - beginOpt + 1) to deleteCount
  1436. else
  1437. put false into enumChosen -- we want it, but check for enum first
  1438. if char beginOpt of y = "," then add 1 to beginOpt
  1439. add Offset(",", char beginOpt to endOpt of y) to beginOpt -- skip keyword
  1440. if "{" is in (char beginOpt to endOpt of y) then -- we have enum
  1441. put beginOpt into enumOffset -- first enum start here
  1442. repeat until enumOffset >= endOpt
  1443. -- determine extent of enum
  1444. put offset("|", char enumOffset to endOpt of y) into enumEnd
  1445. if enumEnd > 0 then
  1446. put enumEnd + enumOffset - 2 into enumEnd
  1447. else
  1448. put endOpt-2 into enumEnd
  1449. end if
  1450. -- enum is chosen if it is bold
  1451. if bold is in (textstyle of char (enumOffset + deleteCount) of line theLine of me) then
  1452. put true into enumChosen
  1453. exit repeat
  1454. else
  1455. put enumEnd + 2 into enumOffset
  1456. end if
  1457. end repeat
  1458. end if
  1459. if enumChosen then
  1460. -- we just pick the chosen one
  1461. put quote into char beginOpt of y
  1462. put quote into char endOpt of y
  1463. put char enumOffset to enumEnd of y into char beginOpt+1 to endOpt-1 of y
  1464. add (endOpt - beginOpt - enumEnd + enumOffset - 2) to deleteCount
  1465. else
  1466. delete char endOpt of y
  1467. add 1 to deleteCount
  1468. end if
  1469. end if
  1470. end if
  1471. else if beginEnum > 0 then
  1472. put false into enumChosen -- we want it, but check for enum first
  1473. put offset ("}", y) into endOpt
  1474. put beginEnum + 1 into enumOffset -- first enum start here
  1475. repeat until enumOffset >= endOpt
  1476. -- determine extent of enum
  1477. put offset("|", char enumOffset to endOpt of y) into enumEnd
  1478. if enumEnd > 0 then
  1479. put enumEnd + enumOffset - 2 into enumEnd
  1480. else
  1481. put endOpt-1 into enumEnd
  1482. end if
  1483. -- enum is chosen if it is bold
  1484. if bold is in (textstyle of char (enumOffset + deleteCount) of line theLine of me) then
  1485. put true into enumChosen
  1486. exit repeat
  1487. else
  1488. put enumEnd + 2 into enumOffset
  1489. end if
  1490. end repeat
  1491. if enumChosen then
  1492. -- we just pick the chosen one
  1493. put quote into char beginEnum of y
  1494. put quote into char endOpt of y
  1495. put char enumOffset to enumEnd of y into char beginEnum+1 to endOpt-1 of y
  1496. add (endOpt - beginEnum - enumEnd + enumOffset - 2) to deleteCount
  1497. else
  1498. put quote into char beginEnum of y
  1499. put quote into char endOpt of y
  1500. end if
  1501. end if
  1502. end repeat
  1503. if char 1 of word 2 of y = "," then
  1504. delete char 1 of word 2 of y
  1505. else if char 1 of word 2 of y = "(" then
  1506. if char 1 of word 3 of y = "," then
  1507. delete char 1 of word 3 of y
  1508. end if
  1509. end if
  1510. PutMyMsgBox y
  1511. end if
  1512. end mouseUp
  1513.  
  1514. On DoEnumStuff cc,sc,cv
  1515. put (word 2 of sc) - (word 2 of cc) + 1 into ccBegin
  1516. put offset("|", char ccBegin to 9999 of cv) into ccEnd
  1517. -- scan forward for "|" or end of enum
  1518. if ccEnd > 0 then -- set the chunk to |
  1519. put (word 2 of sc) + ccEnd - 2 into word 4 of sc
  1520. else -- no more "|", go all the way }
  1521. put (word 2 of sc) + offset("}", char ccBegin to 9999 of cv) - 2 into word 4 of sc
  1522. end if
  1523. -- scan backward for begin of enum
  1524. put word 2 of sc into orgVal
  1525. repeat
  1526. subtract 1 from ccBegin
  1527. if (char ccBegin of cv = "{") or (char ccBegin of cv = "|") then
  1528. put orgVal into word 2 of sc
  1529. exit repeat
  1530. else
  1531. subtract 1 from orgVal
  1532. end if
  1533. end repeat
  1534. set textstyle of sc to "bold,group"
  1535. End DoEnumStuff
  1536.  
  1537. On MouseWithin
  1538. ShowBalloon "This is a list of the Apple Event glue routines for this application." && ¬¨
  1539. "Clicking on a command will move it into the messages field below it."
  1540. end MouseWithin</script>
  1541.     </part>
  1542.     <part>
  1543.         <id>15</id>
  1544.         <type>button</type>
  1545.         <visible> <true /> </visible>
  1546.         <reserved5> 0 </reserved5>
  1547.         <reserved4> 0 </reserved4>
  1548.         <reserved3> 0 </reserved3>
  1549.         <reserved2> 0 </reserved2>
  1550.         <reserved1> 0 </reserved1>
  1551.         <enabled> <true /> </enabled>
  1552.         <rect>
  1553.             <left>466</left>
  1554.             <top>268</top>
  1555.             <right>509</right>
  1556.             <bottom>283</bottom>
  1557.         </rect>
  1558.         <style>shadow</style>
  1559.         <showName> <true /> </showName>
  1560.         <highlight> <false /> </highlight>
  1561.         <autoHighlight> <true /> </autoHighlight>
  1562.         <sharedHighlight> <false /> </sharedHighlight>
  1563.         <family>0</family>
  1564.         <titleWidth>0</titleWidth>
  1565.         <icon>0</icon>
  1566.         <textAlign>center</textAlign>
  1567.         <font>Helvetica</font>
  1568.         <textSize>12</textSize>
  1569.         <textStyle>bold</textStyle>
  1570.         <name>Clear</name>
  1571.         <script>on mouseUp
  1572. if visible of bkgnd field "myResult" then
  1573. if IsTempDesc(field "myResult") then
  1574. AEDisposeDesc(field "myResult")
  1575. end if
  1576. put "" into field "myResult"
  1577. else
  1578. if IsTempDesc(field "myMsgBox") then
  1579. AEDisposeDesc(field "myMsgBox")
  1580. end if
  1581. put "" into field "myMsgBox"
  1582. end if
  1583. end mouseUp
  1584.  
  1585. On MouseWithin
  1586. if visible of bkgnd field "myMsgBox" then
  1587. ShowBalloon "Click this button to clear contents of the field to the left."
  1588. else
  1589. ShowBalloon "Click this button to clear contents of the results field to the left."
  1590. end if
  1591. End MouseWithin
  1592. </script>
  1593.     </part>
  1594.     <part>
  1595.         <id>16</id>
  1596.         <type>button</type>
  1597.         <visible> <true /> </visible>
  1598.         <reserved5> 0 </reserved5>
  1599.         <reserved4> 0 </reserved4>
  1600.         <reserved3> 0 </reserved3>
  1601.         <reserved2> 0 </reserved2>
  1602.         <reserved1> 0 </reserved1>
  1603.         <enabled> <true /> </enabled>
  1604.         <rect>
  1605.             <left>466</left>
  1606.             <top>286</top>
  1607.             <right>509</right>
  1608.             <bottom>301</bottom>
  1609.         </rect>
  1610.         <style>shadow</style>
  1611.         <showName> <true /> </showName>
  1612.         <highlight> <false /> </highlight>
  1613.         <autoHighlight> <true /> </autoHighlight>
  1614.         <sharedHighlight> <false /> </sharedHighlight>
  1615.         <family>0</family>
  1616.         <titleWidth>0</titleWidth>
  1617.         <icon>0</icon>
  1618.         <textAlign>center</textAlign>
  1619.         <font>Helvetica</font>
  1620.         <textSize>12</textSize>
  1621.         <textStyle>bold</textStyle>
  1622.         <name>Do It</name>
  1623.         <script>on mouseUp
  1624. if the short name of me = "Do It" then
  1625. -- note we use very long variable name here
  1626. -- we do this to aviod conflict with the same name in msg box
  1627. put field "myMsgBox" into theScriptFromMyMsgBox
  1628. if IsTempDesc(field "myResult") then
  1629. AEDisposeDesc(field "myResult")
  1630. end if
  1631. put "" into field "myResult"
  1632. ShowResult
  1633. repeat with curLineInScriptFromMyMsgBox = 1 to number of lines in theScriptFromMyMsgBox
  1634. put line curLineInScriptFromMyMsgBox of theScriptFromMyMsgBox into curStatementFromMsgBox
  1635. if (word 1 of curStatementFromMsgBox contains "(") ¬¨
  1636. or (char 1 of word 2 of curStatementFromMsgBox = "(") then
  1637. -- it is a function
  1638. if IsTempDesc(field "myResult") then
  1639. AEDisposeDesc(field "myResult")
  1640. end if
  1641. put value of curStatementFromMsgBox into field "myResult"
  1642. else
  1643. do curStatementFromMsgBox
  1644. end if
  1645. end repeat
  1646. else
  1647. ShowScript
  1648. end if
  1649. end mouseUp
  1650.  
  1651. On MouseWithin
  1652. if the short name of me = "Do It" then
  1653. ShowBalloon "Click this button to execute the messages field to the left."
  1654. else
  1655. ShowBalloon "Click this button to display the special messages field."
  1656. end if
  1657. End MouseWithin
  1658. </script>
  1659.     </part>
  1660.     <part>
  1661.         <id>17</id>
  1662.         <type>button</type>
  1663.         <visible> <true /> </visible>
  1664.         <reserved5> 0 </reserved5>
  1665.         <reserved4> 0 </reserved4>
  1666.         <reserved3> 0 </reserved3>
  1667.         <reserved2> 0 </reserved2>
  1668.         <reserved1> 0 </reserved1>
  1669.         <enabled> <true /> </enabled>
  1670.         <rect>
  1671.             <left>289</left>
  1672.             <top>24</top>
  1673.             <right>306</right>
  1674.             <bottom>40</bottom>
  1675.         </rect>
  1676.         <style>transparent</style>
  1677.         <showName> <false /> </showName>
  1678.         <highlight> <false /> </highlight>
  1679.         <autoHighlight> <true /> </autoHighlight>
  1680.         <sharedHighlight> <true /> </sharedHighlight>
  1681.         <family>0</family>
  1682.         <titleWidth>0</titleWidth>
  1683.         <icon>15420</icon>
  1684.         <textAlign>center</textAlign>
  1685.         <font>Chicago</font>
  1686.         <textSize>12</textSize>
  1687.         <textStyle>plain</textStyle>
  1688.         <name></name>
  1689.         <script>on MouseWithin
  1690. ShowBalloon "Click here to go to the previous application card."
  1691. end MouseWithin
  1692.  
  1693. on mouseUp
  1694. visual wipe right
  1695. go previous card of this background
  1696. end mouseUp</script>
  1697.     </part>
  1698.     <part>
  1699.         <id>18</id>
  1700.         <type>button</type>
  1701.         <visible> <true /> </visible>
  1702.         <reserved5> 0 </reserved5>
  1703.         <reserved4> 0 </reserved4>
  1704.         <reserved3> 0 </reserved3>
  1705.         <reserved2> 0 </reserved2>
  1706.         <reserved1> 0 </reserved1>
  1707.         <enabled> <true /> </enabled>
  1708.         <rect>
  1709.             <left>309</left>
  1710.             <top>24</top>
  1711.             <right>324</right>
  1712.             <bottom>40</bottom>
  1713.         </rect>
  1714.         <style>transparent</style>
  1715.         <showName> <false /> </showName>
  1716.         <highlight> <false /> </highlight>
  1717.         <autoHighlight> <true /> </autoHighlight>
  1718.         <sharedHighlight> <true /> </sharedHighlight>
  1719.         <family>0</family>
  1720.         <titleWidth>0</titleWidth>
  1721.         <icon>16560</icon>
  1722.         <textAlign>center</textAlign>
  1723.         <font>Chicago</font>
  1724.         <textSize>12</textSize>
  1725.         <textStyle>plain</textStyle>
  1726.         <name></name>
  1727.         <script>on MouseWithin
  1728. ShowBalloon "Click here to go to the next application card."
  1729. end MouseWithin
  1730.  
  1731. on mouseUp
  1732. visual wipe left
  1733. go next card of this background
  1734. end mouseUp</script>
  1735.     </part>
  1736.     <part>
  1737.         <id>19</id>
  1738.         <type>button</type>
  1739.         <visible> <true /> </visible>
  1740.         <reserved5> 0 </reserved5>
  1741.         <reserved4> 0 </reserved4>
  1742.         <reserved3> 0 </reserved3>
  1743.         <reserved2> 0 </reserved2>
  1744.         <reserved1> 0 </reserved1>
  1745.         <enabled> <true /> </enabled>
  1746.         <rect>
  1747.             <left>488</left>
  1748.             <top>23</top>
  1749.             <right>508</right>
  1750.             <bottom>41</bottom>
  1751.         </rect>
  1752.         <style>transparent</style>
  1753.         <showName> <false /> </showName>
  1754.         <highlight> <false /> </highlight>
  1755.         <autoHighlight> <true /> </autoHighlight>
  1756.         <sharedHighlight> <true /> </sharedHighlight>
  1757.         <family>0</family>
  1758.         <titleWidth>0</titleWidth>
  1759.         <icon>6720</icon>
  1760.         <textAlign>center</textAlign>
  1761.         <font>Chicago</font>
  1762.         <textSize>12</textSize>
  1763.         <textStyle>plain</textStyle>
  1764.         <name></name>
  1765.         <script>on MouseWithin
  1766. ShowBalloon "Click here to go back to the applications list card."
  1767. end MouseWithin
  1768.  
  1769. on mouseUp
  1770. HMRemoveBalloon
  1771. visual dissolve
  1772. go to card id 8694
  1773. end mouseUp
  1774.  
  1775. </script>
  1776.     </part>
  1777.     <part>
  1778.         <id>21</id>
  1779.         <type>field</type>
  1780.         <visible> <false /> </visible>
  1781.         <dontWrap> <false /> </dontWrap>
  1782.         <dontSearch> <false /> </dontSearch>
  1783.         <sharedText> <false /> </sharedText>
  1784.         <fixedLineHeight> <false /> </fixedLineHeight>
  1785.         <autoTab> <false /> </autoTab>
  1786.         <lockText> <false /> </lockText>
  1787.         <rect>
  1788.             <left>8</left>
  1789.             <top>256</top>
  1790.             <right>461</right>
  1791.             <bottom>337</bottom>
  1792.         </rect>
  1793.         <style>scrolling</style>
  1794.         <autoSelect> <false /> </autoSelect>
  1795.         <showLines> <false /> </showLines>
  1796.         <wideMargins> <false /> </wideMargins>
  1797.         <multipleLines> <false /> </multipleLines>
  1798.         <reservedFamily> 0 </reservedFamily>
  1799.         <titleWidth>0</titleWidth>
  1800.         <icon>0</icon>
  1801.         <textAlign>left</textAlign>
  1802.         <font>Monaco</font>
  1803.         <textSize>9</textSize>
  1804.         <textStyle>plain</textStyle>
  1805.         <textHeight>12</textHeight>
  1806.         <name>myResult</name>
  1807.         <script>On MouseWithin
  1808. put CharToNum(char 1 of me) into x
  1809. if ((char 1 of me) = (char 6 of me)) and ((x = 174) or (x = 190)) then
  1810. ShowBalloon me
  1811. else
  1812. ShowBalloon "this is the result of executing your script."
  1813. end if
  1814. End MouseWithin
  1815. </script>
  1816.     </part>
  1817.     <part>
  1818.         <id>22</id>
  1819.         <type>button</type>
  1820.         <visible> <true /> </visible>
  1821.         <reserved5> 0 </reserved5>
  1822.         <reserved4> 0 </reserved4>
  1823.         <reserved3> 0 </reserved3>
  1824.         <reserved2> 0 </reserved2>
  1825.         <reserved1> 0 </reserved1>
  1826.         <enabled> <true /> </enabled>
  1827.         <rect>
  1828.             <left>466</left>
  1829.             <top>304</top>
  1830.             <right>509</right>
  1831.             <bottom>319</bottom>
  1832.         </rect>
  1833.         <style>shadow</style>
  1834.         <showName> <true /> </showName>
  1835.         <highlight> <false /> </highlight>
  1836.         <autoHighlight> <true /> </autoHighlight>
  1837.         <sharedHighlight> <false /> </sharedHighlight>
  1838.         <family>0</family>
  1839.         <titleWidth>0</titleWidth>
  1840.         <icon>0</icon>
  1841.         <textAlign>center</textAlign>
  1842.         <font>Helvetica</font>
  1843.         <textSize>12</textSize>
  1844.         <textStyle>bold</textStyle>
  1845.         <name>Save</name>
  1846.         <script>on mouseUp
  1847. if there is a card button "Test" then
  1848. put script of card button "Test" into btnScript
  1849. -- save the message box
  1850. if field "myMsgBox" = "" then
  1851. answer "There is no script to save"
  1852. else
  1853. put AllHandlerName(btnScript) into handlerNameList
  1854. ask "Please name this handler.  (Enter '?' to save the script to an existing handler.)" with "test" & the ticks
  1855. put it into handlerName
  1856. put "Cancel" into action
  1857. put 1 into i
  1858. repeat until i = 0
  1859. put Offset(space, handlerName) into i
  1860. if i > 0 then delete char i of handlerName
  1861. end repeat
  1862. if handlerName = "" then
  1863. else if handlerName = "?" then
  1864. put ShowList(FirstItemOfEachLine(handlerNameList), "Save to which existing handler?", false, ¬¨
  1865. true, "Append,Replace,Cancel", 0) into temp
  1866. put line 1 of temp into action
  1867. if action <> cancel then
  1868. put line 2 of temp into i
  1869. put item 1 of line i of handlerNameList into handlerName
  1870. put item 2 of line i of handlerNameList into beginHandler
  1871. put item 3 of line i of handlerNameList into endHandler
  1872. end if
  1873. else
  1874. put Search(handlerNameList, handlerName, true) into x
  1875. if x = "" then
  1876. put "new" into action
  1877. else
  1878. answer "Handler already exists, what should we do?" with "Cancel" or "Replace" or "Append"
  1879. put it into action
  1880. if action <> "Cancel" then
  1881. put item 1 of x into i
  1882. put item 2 of line i of handlerNameList into beginHandler
  1883. put item 3 of line i of handlerNameList into endHandler
  1884. end if
  1885. end if
  1886. end if
  1887. if action = "new" then
  1888. put return & "On" && handlerName & return & ScriptFromMsgBox() & return after btnScript
  1889. put "End" && handlerName & return after btnScript
  1890. else if endHandler <> 0 then
  1891. if action = "Replace" then
  1892. put ScriptFromMsgBox() into line beginHandler to endHandler of btnScript
  1893. else if action = "Append" then
  1894. put return & ScriptFromMsgBox() after line endHandler of btnScript
  1895. end if
  1896. end if
  1897. end if
  1898. if action <> "cancel" then
  1899. Set the script of card button "test" to btnScript
  1900. end if
  1901. else
  1902. answer "You do not have a Test button" with "Cancel"
  1903. end if
  1904. end mouseUp
  1905.  
  1906. Function ScriptFromMsgBox
  1907. put field "myMsgBox" into myMsgBox
  1908. put number of lines in myMsgBox into n
  1909. put 0 into lastFunc
  1910. repeat with i = 1 to n
  1911. put line i of myMsgBox into x
  1912. if (word 1 of x contains "(") or (char 1 of word 2 of x = "(") then
  1913. put i into lastFunc
  1914. end if
  1915. end repeat
  1916. repeat with i = 1 to n
  1917. put line i of myMsgBox into x
  1918. if (word 1 of x contains "(") or (char 1 of word 2 of x = "(") then
  1919. if i <> lastFunc then
  1920. put "AEDisposeDesc " before line i of myMsgBox
  1921. else
  1922. put "put " before line i of myMsgBox
  1923. end if
  1924. end if
  1925. end repeat
  1926. if last char of myMsgBox = return then
  1927. delete last char of myMsgBox
  1928. end if
  1929. return myMsgBox
  1930. End ScriptFromMsgBox
  1931.  
  1932. On MouseWithin
  1933. ShowBalloon "Clicking here put the contents of messages field into the script of the button 'Test.'"
  1934. End MouseWithin
  1935. </script>
  1936.     </part>
  1937.     <part>
  1938.         <id>24</id>
  1939.         <type>field</type>
  1940.         <visible> <true /> </visible>
  1941.         <dontWrap> <false /> </dontWrap>
  1942.         <dontSearch> <false /> </dontSearch>
  1943.         <sharedText> <false /> </sharedText>
  1944.         <fixedLineHeight> <false /> </fixedLineHeight>
  1945.         <autoTab> <false /> </autoTab>
  1946.         <lockText> <true /> </lockText>
  1947.         <rect>
  1948.             <left>11</left>
  1949.             <top>242</top>
  1950.             <right>137</right>
  1951.             <bottom>257</bottom>
  1952.         </rect>
  1953.         <style>transparent</style>
  1954.         <autoSelect> <false /> </autoSelect>
  1955.         <showLines> <false /> </showLines>
  1956.         <wideMargins> <false /> </wideMargins>
  1957.         <multipleLines> <false /> </multipleLines>
  1958.         <reservedFamily> 0 </reservedFamily>
  1959.         <titleWidth>0</titleWidth>
  1960.         <icon>0</icon>
  1961.         <textAlign>left</textAlign>
  1962.         <font>Geneva</font>
  1963.         <textSize>9</textSize>
  1964.         <textStyle>plain</textStyle>
  1965.         <textHeight>12</textHeight>
  1966.         <name>lowerFieldTitle</name>
  1967.         <script></script>
  1968.     </part>
  1969.     <name>AppCards</name>
  1970.     <script>on openStack
  1971. if the screenRect is "0,0,512,342" then set the loc of cd window to "0,0"
  1972. if the userLevel < 5 then set the userLevel to 5
  1973. if the systemVersion < "7.0" then -- Systems < 7.0 don't support Apple Events.
  1974. answer "You must be running System 7.0 or later to send Apple Events‚Ñ¢"¬¨
  1975. &&"from this stack."
  1976. end if
  1977. if the version < "2.1" then -- HyperCard < 2.1 doesn't support Apple Events.
  1978. answer "HyperCard version 2.1 or later is required to use this stack."
  1979. end if
  1980. end openStack
  1981.  
  1982. on closeStack
  1983. if the freesize of this stack > 32768 then
  1984. get there is a menuItem "Compact Stack" of menu "File"
  1985. if it then doMenu "Compact Stack"
  1986. end if
  1987. pass closeStack
  1988. end closeStack
  1989.  
  1990. on resumeStack
  1991. if the userLevel < 5 then set the userLevel to 5
  1992. end resumeStack
  1993.  
  1994. on go
  1995. HMRemoveBalloon -- Removes any vestigal balloons which may have
  1996. pass go                          -- left from the "ShowBalloon" XCMD.
  1997. end go
  1998.  
  1999. on NewCard
  2000. set lockscreen to true
  2001. put "On MouseUp" & return & "PickMouseUpScript" & return ¬¨
  2002. & "end MouseUp" & return ¬¨
  2003. & "On MouseWithin" & return & "ShowBalloon " & quote ¬¨
  2004. & "Click here to execute, edit or export a test script:" & quote & return ¬¨
  2005. & "end MouseWithin" & return after btnScript
  2006. doMenu "new button"
  2007. get "cd btn id" && the id of cd btn "new button"
  2008. set the name of it to "Test"
  2009. set the textFont of it to "Helvetica"
  2010. set the textStyle of it to "bold"
  2011. set the rect of it to "466,250,509,265"
  2012. set the style of it to shadow
  2013. set the autoHilite of it to true
  2014. set the script of it to btnScript
  2015. choose browse tool
  2016. set lockscreen to false
  2017. end NewCard
  2018.  
  2019. On CmdOrObjButton
  2020. if field "classNameList" <> "" then
  2021. if short name of bkgnd button id 6 = "cmd" then
  2022. set name of bkgnd button id 6 to "obj"
  2023. end if
  2024. show bkgnd button id 6
  2025. else
  2026. hide bkgnd button id 6
  2027. end if
  2028. End CmdOrObjButton
  2029.  
  2030. On OpenCard
  2031. ShowScript
  2032. Show field "eventList"
  2033. CmdOrObjButton
  2034. AEStartTargeting field "targetApp","NoLaunch"
  2035. if field "targetApp" = "" then Click At loc of bkgnd button "Read Aete"
  2036. pass OpenCard
  2037. End OpenCard
  2038.  
  2039. On CloseCard
  2040. AEStopTargeting
  2041. if IsTempDesc(field "myMsgBox") then
  2042. AEDisposeDesc(field "myMsgBox")
  2043. put "" into field "myMsgBox"
  2044. end if
  2045. if field "targetApp" = "" then
  2046. put "Unknown Application" && Random(1000) into field "targetApp"
  2047. end if
  2048. put short name of this card into x
  2049. if x <> field "targetApp" then
  2050. set name of this card to field "targetApp"
  2051. MakeNameList
  2052. end if
  2053. pass CloseCard
  2054. End CloseCard
  2055.  
  2056. On CloseStack
  2057. global editAEScript
  2058. put "" into editAEScript
  2059. pass closeStack
  2060. End CloseStack
  2061.  
  2062. -- on EnterKey
  2063. -- click at loc of bkgnd button id 16
  2064. -- end EnterKey
  2065.  
  2066. on ShowScript
  2067. put "Messages:" into fld "lowerFieldTitle"
  2068. Show Field "myMsgBox"
  2069. Hide Field "myResult"
  2070. Show bkgnd button "Save"
  2071. set name of bkgnd button id 16 to "Do It"
  2072. end ShowScript
  2073.  
  2074. on ShowResult
  2075. put "Results:" into fld "lowerFieldTitle"
  2076. Show Field "myResult"
  2077. Hide bkgnd button "Save"
  2078. set name of bkgnd button id 16 to "Script"
  2079. end ShowResult
  2080.  
  2081. on PutMyMsgBox statement
  2082. global myMsgBoxSelection
  2083. put myMsgBoxSelection into x
  2084. delete word 1 to 4 of x
  2085. if x = "of bkgnd field 2" then
  2086. put "put statement into " before myMsgBoxSelection
  2087. do myMsgBoxSelection
  2088. else
  2089. if field "myMsgBox" <> "" then
  2090. put return before statement
  2091. end if
  2092. put statement after field "myMsgBox"
  2093. end if
  2094. put "" into myMsgBoxSelection
  2095. if field "myMsgBox" is not visible then ShowScript
  2096. end PutMyMsgBox
  2097.  
  2098. On MakeNameList
  2099. put "" into nameList
  2100. put number of cards in this bg into n
  2101. repeat with i = 1 to n
  2102. get the short name of card i of this bg
  2103. put it & return after nameList
  2104. end repeat
  2105. put nameList into card field "appList" of card "appList"
  2106. End MakeNameList
  2107.  
  2108. on deletecard
  2109. pass deletecard
  2110. end deletecard
  2111.  
  2112. On StartChunkExpr
  2113. put "" into field "chunkExp"
  2114. put "done" into field "cardState"
  2115. MakePickList "capp","pickElem"
  2116. End StartChunkExpr
  2117.  
  2118. Function ClassCodeToName classCode
  2119. put field "classNameList" into classNameList
  2120. put number of lines in classNameList into n
  2121. repeat with i = 1 to n
  2122. if classCode = item 1 of line i of classNameList then
  2123. return item 2 of line i of classNameList
  2124. end if
  2125. end repeat
  2126. if classCode = "capp" then return "application"
  2127. return "?" & classCode & "?"
  2128. End ClassCodeToName
  2129.  
  2130. Function ClassNameToCode className
  2131. put field "classNameList" into classNameList
  2132. put number of lines in classNameList into n
  2133. repeat with i = 1 to n
  2134. if className = item 2 of line i of classNameList then
  2135. return item 1 of line i of classNameList
  2136. end if
  2137. end repeat
  2138. if className = "application" then return "capp"
  2139. return "????"
  2140. End ClassNameToCode
  2141.  
  2142. Function KeyFormNameToCode keyFormName
  2143. put field "keyFormList" into keyFormList
  2144. put number of items in keyFormList into n
  2145. put 1 into i
  2146. repeat while i <= n
  2147. if item i of keyFormList = keyFormName then
  2148. return item i+1 of keyFormList
  2149. end if
  2150. add 2 to i
  2151. end repeat
  2152. return keyFormName
  2153. end KeyFormNameToCode
  2154.  
  2155. Function PropertyList classCode
  2156. put "" into propList
  2157. put field "classNameList" into classNameList
  2158. put number of lines in classNameList into n
  2159. repeat with i = 1 to n
  2160. if item 1 of line i of classNameList = classCode then
  2161. put line i of classNameList into classInfo
  2162. put (number of items in classInfo) div 2 - 1 into propCount
  2163. put 3 into j
  2164. repeat propCount times
  2165. put item j of classInfo && "property" & return after propList
  2166. add 2 to j
  2167. end repeat
  2168. exit repeat
  2169. end if
  2170. end repeat
  2171. return propList
  2172. End PropertyList
  2173.  
  2174. Function ElementList classCode
  2175. put field "hierarchyList" into hierarchyList
  2176. put "" into elemList
  2177. put number of lines in hierarchyList into n
  2178. if classCode <> "capp" then
  2179. put ClassCodeToName(classCode) && "itself" & return after elemList
  2180. end if
  2181. put number of lines in hierarchyList into n
  2182. repeat with i = 1 to n
  2183. if item 1 of line i of hierarchyList = classCode then
  2184. put line i of hierarchyList into itemList
  2185. put number of items in itemList into itemCount
  2186. repeat with j = 2 to itemCount
  2187. put ClassCodeToName(char 1 to 4 of item j of itemList) & return after elemList
  2188. end repeat
  2189. exit repeat
  2190. end if
  2191. end repeat
  2192. return elemList
  2193. End ElementList
  2194.  
  2195. Function KeyFormList containerClass, elementClass
  2196. put field "hierarchyList" into hierarchyList
  2197. put field "KeyFormList" into keyFormName
  2198. put number of lines in hierarchyList into n
  2199. put number of items in keyFormName into keyNameCount
  2200. repeat with i = 1 to n
  2201. if containerClass = item 1 of line i of hierarchyList then
  2202. put line i of hierarchyList into classInfo
  2203. put number of items in classInfo into m
  2204. repeat with j = 2 to m
  2205. if char 1 to 4 of item j of classInfo = elementClass then
  2206. put char 5 to 10000 of item j of classInfo into x
  2207. if field "compareList" <> "" then put "whose" & return into rst
  2208. repeat while x <> ""
  2209. put char 1 to 4 of x into thisKey
  2210. put 2 into k
  2211. repeat while k <= keyNameCount
  2212. if item k of keyFormName = thisKey then
  2213. put item k-1 of keyFormName into thisKey
  2214. exit repeat
  2215. end if
  2216. add 2 to k
  2217. end repeat
  2218. put thisKey & return after rst
  2219. delete char 1 to 4 of x
  2220. end repeat
  2221. return rst
  2222. end if
  2223. end repeat
  2224. end if
  2225. end repeat
  2226. return ""
  2227. End KeyFormList
  2228.  
  2229. On MakeCompareList
  2230. put field "compareList" into compareList
  2231. put "" into rst
  2232. put number of items in compareList into n
  2233. repeat with i = 1 to n
  2234. put item i of compareList & return after rst
  2235. end repeat
  2236. put rst into field "pickList"
  2237. End MakeCompareList
  2238.  
  2239. Function PropNameToCode classCode, propName
  2240. put field "classNameList" into classNameList
  2241. put number of lines in classNameList into n
  2242. repeat with i = 1 to n
  2243. if classCode = item 1 of line i of classNameList then
  2244. put line i of classNameList into classInfo
  2245. put (number of items in classInfo) div 2 - 1 into propCount
  2246. put 3 into j
  2247. repeat propCount times
  2248. if item j of classInfo = propName then
  2249. return item j+1 of classInfo
  2250. end if
  2251. add 2 to j
  2252. end repeat
  2253. exit repeat
  2254. end if
  2255. end repeat
  2256. return "????"
  2257. End PropNameToCode
  2258.  
  2259. Function PropCodeToName classCode, propCode
  2260. put field "classNameList" into classNameList
  2261. put number of lines in classNameList into n
  2262. repeat with i = 1 to n
  2263. if classCode = item 1 of line i of classNameList then
  2264. put line i of classNameList into classInfo
  2265. put (number of items in classInfo) div 2 - 1 into propCount
  2266. put 4 into j
  2267. repeat propCount times
  2268. if item j of classInfo = propCode then
  2269. return item j-1 of classInfo
  2270. end if
  2271. add 2 to j
  2272. end repeat
  2273. exit repeat
  2274. end if
  2275. end repeat
  2276. return "????"
  2277. End PropCodeToName
  2278.  
  2279. on MakePickList classCode, stateCode
  2280. put stateCode into nextCode
  2281. if (stateCode = "pickObj1") or (stateCode = "pickObj2") then
  2282. put stateCode into last item of line 1 of field "cardState"
  2283. if stateCode = "pickObj1" then
  2284. put "Search" && ClassCodeToName(classCode) && "whose" into field "operation"
  2285. else if stateCode = "pickObj2" then
  2286. put number of items in line 2 of field "cardState" into x
  2287. put item (x-1) of line 2 of field "cardState" into classCode
  2288. put classCode into item x of line 2 of field "cardState"
  2289. end if
  2290. put "pickElem" into nextCode
  2291. else if stateCode = "pickElem" then
  2292. put "Click to select an element or property of this" && ClassCodeToName(classCode)&":" into field "operation"
  2293. end if
  2294. if (nextCode = "pickElem") then
  2295. put ElementList(classCode) into x
  2296. if stateCode = "pickObj1" then
  2297. delete line 1 of x
  2298. else if stateCode = "pickObj2" then
  2299. put "constant" into line 1 of x
  2300. end if
  2301. put propertyList(classCode) after x
  2302. put x into field "pickList"
  2303. put classCode into last item of line 2 of field "cardState"
  2304. put "," & stateCode after line 1 of field "cardState"
  2305. end if
  2306. end MakePickList
  2307.  
  2308. function UnParse theCode,startIndex,container
  2309. put length(theCode) into n
  2310. repeat while startIndex <= n
  2311. put char startIndex to (startIndex+3) of theCode into curCode
  2312. put char (startIndex+4) to (startIndex+7) of theCode into curType
  2313. if container <> "" then
  2314. put ", " & container into container
  2315. end if
  2316. if curType = "prop" then
  2317. put "AEObjectSpec(" & quote & prop & quote & ", " & quote & "prop" ¬¨
  2318. & quote & ", " & quote & curCode & quote & container & ")" into container
  2319. add 8 to startIndex
  2320. else if curType = "test" then
  2321. add 9 to startIndex
  2322. put UnParse(theCode,startIndex,"Exmn()") into temp
  2323. put line 1 of temp into obj1
  2324. put line 2 of temp into startIndex
  2325. put char (startIndex) to (startIndex+3) of theCode into compCode
  2326. add 5 to startIndex
  2327. put UnParse(theCode,startIndex,"Exmn()") into temp
  2328. put line 1 of temp into obj2
  2329. put line 2 of temp into startIndex
  2330. put "AEObjectSpec(" & quote & curCode & quote & ", test, " & ¬¨
  2331. "AECompareSpec(" & quote & compCode & quote & "," & obj1 & "," ¬¨
  2332. & obj2 & ")" & container & ")" into container
  2333. else
  2334. add 9 to startIndex
  2335. put startIndex into orgIndex
  2336. repeat until char startIndex of theCode = ")"
  2337. add 1 to startIndex
  2338. end repeat
  2339. put char orgIndex to (startIndex-1) of theCode into v
  2340. add 1 to startIndex
  2341. if (curType = "cnst") and (curCode = "cnst") then
  2342. put quote & v & quote into container
  2343. else
  2344. put "AEObjectSpec(" & quote & curCode & quote & ", " & ¬¨
  2345. quote & curType & quote & ", " & v & container & ")" into container
  2346. end if
  2347. end if
  2348. put char startIndex of theCode into temp
  2349. add 1 to startIndex
  2350. if temp <> "." then
  2351. exit repeat
  2352. end if
  2353. end repeat
  2354. return container & return & startIndex
  2355. end UnParse
  2356.  
  2357. On ChunkComplete
  2358. delete last item of line 1 of field "cardState"
  2359. put last item of line 1 of field "cardState" into curState
  2360. if curState = "pickObj1" then
  2361. put "pickCmpr" into last item of line 1 of field "cardState"
  2362. put "," after field "chunkExp"
  2363. MakeCompareList
  2364. else if curState = "pickObj2" then
  2365. put ")." after field "chunkExp"
  2366. put last item of line 2 of field "cardState" into temp
  2367. delete last item of line 1 of field "cardState"
  2368. delete last item of line 2 of field "cardState"
  2369. MakePickList temp,"pickElem"
  2370. else if curState = "done" then
  2371. put "1. Click parameters to select them.   2. Then click handler names to copy them to the messages field below:" into field "operation"
  2372. put "" into field "pickList"
  2373. put line 1 of UnParse(field "chunkExp", 1) into temp
  2374. PutMyMsgBox temp
  2375. set name of bkgnd button id 6 to "obj"
  2376. Show field "eventList"
  2377. end if
  2378. End ChunkComplete
  2379.  
  2380. function isTempDesc theStr
  2381. if (CharToNum(char 1 of theStr) = 190) then
  2382. if (CharToNum(char 6 of theStr) = 190) then
  2383. global createdDesc
  2384. put number of items in createdDesc into n
  2385. repeat with i = 1 to n
  2386. if item i of createdDesc = theStr then
  2387. return true
  2388. end if
  2389. end repeat
  2390. end if
  2391. end if
  2392. return false
  2393. end isTempDesc
  2394.  
  2395. Function FirstItemOfEachLine theList
  2396. put "" into rst
  2397. put number of lines of theList into n
  2398. repeat with i = 1 to n
  2399. put item 1 of line i of theList into x
  2400. if x <> "mouseUp" and x <> "mouseWithin" then
  2401. put x & return after rst
  2402. end if
  2403. end repeat
  2404. return rst
  2405. End FirstItemOfEachLine
  2406.  
  2407. Function AllHandlerName theScript
  2408. put "" into mosueUpInfo
  2409. put number of lines of theScript into n
  2410. put "" into handlerList
  2411. repeat with i = 1 to n -- find where the script is
  2412. if word 1 of line i of theScript = "on" then
  2413. put 0 into endHandler
  2414. put word 2 of line i of theScript into handlerName
  2415. put i+1 into beginHandler
  2416. repeat with j = beginHandler to n
  2417. if word 1 of line j of theScript = "end" ¬¨
  2418. and word 2 of line j of theScript = handlerName then
  2419. put j-1 into endHandler
  2420. exit repeat
  2421. end if
  2422. end repeat
  2423. put j into i
  2424. if endHandler <> 0 then
  2425. if handlerName = "mouseUp" then
  2426. put handlerName & "," & beginHandler & "," & endHandler into mouseUpInfo
  2427. else if handlerName = "mouseWithin" then
  2428. else
  2429. put handlerName & "," & beginHandler & "," & endHandler & return after handlerList
  2430. end if
  2431. end if
  2432. end if
  2433. end repeat
  2434. if mouseUpInfo <> "" then put mouseUpInfo & return after handlerList
  2435. return handlerList
  2436. End AllHandlerName
  2437.  
  2438. On PickMouseUpScript
  2439. put the script of target into btnScript
  2440. if the optionKey is down then
  2441. -- we just execute the first script
  2442. put number of lines in btnScript into n
  2443. repeat with i = 1 to n
  2444. if word 1 of line i of btnScript = "on" then
  2445. put word 2 of line i of btnScript into handlerName
  2446. if (handlerName <> "mouseUp") and (handlerName <> "mouseWithin") then
  2447. send handlerName to the target
  2448. exit repeat
  2449. end if
  2450. end if
  2451. end repeat
  2452. else
  2453. put AllHandlerName(btnScript) into handlerInfoList -- list of all handlers
  2454. put false into done
  2455. repeat until done
  2456. put ShowList(FirstItemOfEachLine(handlerInfoList), ¬¨
  2457. "Pick a handler to Execute or all the handlers to exprt", ¬¨
  2458. true, true, "Execute,Edit,Export,Cancel",1) into temp
  2459. put line 1 of temp into action
  2460. if (action = "Execute") or (action = "Edit") then
  2461. put number of items in line 2 of temp into n
  2462. if n > 1 then
  2463. -- you selected too many
  2464. answer "Too many handlers have been selected" with "Retry" or "Cancel"
  2465. if it = "Cancel" then
  2466. put true into done
  2467. end if
  2468. else
  2469. if n = 1 then
  2470. put line 2 of temp into i
  2471. put item 1 of line i of handlerInfoList into handlerName
  2472. if i <> 1 then
  2473. -- move it to the front
  2474. put (item 2 of line i of handlerInfoList) - 1 into sc1
  2475. put (item 3 of line i of handlerInfoList) + 1 into sc2
  2476. get line sc1 to sc2 of btnScript
  2477. if line sc2+1 of btnScript = "" then
  2478. add 1 to sc2
  2479. end if
  2480. delete line sc1 to sc2 of btnScript
  2481. put it & return & return before btnScript
  2482. Set the script of target to btnScript
  2483. end if
  2484. if action = "Execute" then
  2485. send handlerName to the target
  2486. else
  2487. edit the script of the target
  2488. end if
  2489. end if
  2490. put true into done
  2491. end if
  2492. else
  2493. put true into done
  2494. if action = "Export" then
  2495. -- make self executing script stack
  2496. put field "targetApp" into appName
  2497. put appName & " glue stack" into glueName
  2498. if there is no stack glueName then
  2499. put short name of this stack into myStackName
  2500. -- copy script from the stack script and card script
  2501. put script of this stack into thisScript
  2502. put return & script of this card after thisScript
  2503. create stack glueName in a new window
  2504. if the result = "" then
  2505. set the script of stack glueName to thisScript
  2506. domenu "Close Stack"
  2507. CopyRes "XCMD",3327,myStackName,glueName
  2508. CopyRes "XCMD",3331,myStackName,glueName
  2509. CopyRes "XCMD",3336,myStackName,glueName
  2510. CopyRes "XFCN",3328,myStackName,glueName
  2511. CopyRes "XFCN",3329,myStackName,glueName
  2512. CopyRes "XFCN",3330,myStackName,glueName
  2513. CopyRes "XFCN",3337,myStackName,glueName
  2514. CopyRes "XFCN",3338,myStackName,glueName
  2515. CopyRes "XFCN",3339,myStackName,glueName
  2516. CopyRes "XFCN",3340,myStackName,glueName
  2517. CopyRes "XFCN",3341,myStackName,glueName
  2518. CopyRes "XFCN",3342,myStackName,glueName
  2519. end if
  2520. end if
  2521. put quote & appName & quote into appName
  2522. put quote & glueName & quote into glueName
  2523. put line 2 of temp into makeScriptList
  2524. put number of items in makeScriptList into n
  2525. repeat with i = 1 to n
  2526. put item i of makeScriptList into j
  2527. put item 1 of line j of handlerInfoList into handlerName
  2528. put item 2 of line j of handlerInfoList into beginHandler
  2529. put item 3 of line j of handlerInfoList into endHandler
  2530. put line beginHandler to endHandler of btnScript into thisScript
  2531. ask file "Make a self-executing stack with name:" with handlerName
  2532. if the result <> "Cancel" and it <> "" then
  2533. put it into handlerName
  2534. if there is a stack "Self-executing Stack ProtoType" then
  2535. save stack "Self-executing Stack ProtoType" as stack handlerName
  2536. if the result = "" then
  2537. go to stack handlerName in a new window
  2538. end if
  2539. else
  2540. create stack handlerName in a new window
  2541. if the result = "" then
  2542. set the rect of this card to "0,0,64,64"
  2543. set the loc of card window to "0,40"
  2544. end if
  2545. end if
  2546. if the result = "" then
  2547. put "On OpenStack" & return ¬¨
  2548. & "if the optionKey is down then" & return & "Edit the script of me" & return ¬¨
  2549. & "else" & return & "Hide card window" & return ¬¨
  2550. & "Start Using Stack " & glueName & return ¬¨
  2551. & "MakeSureLaunched" && appName & return before thisScript
  2552. put return & "Stop Using Stack " & glueName & return ¬¨
  2553. & "if the enabled of menuitem 3 of menu file then" & return ¬¨
  2554. & "doMenu " & quote & "Close Stack" & quote & return ¬¨
  2555. & "else" & return & "doMenu" & quote & "Quit HyperCard" & quote ¬¨
  2556. & return & "end if" & return & "end if" & return ¬¨
  2557. & "End OpenStack" after thisScript
  2558. set the script of stack handlerName to thisScript
  2559. domenu "Close Stack"
  2560. end if
  2561. end if
  2562. end repeat
  2563. end if
  2564. end if
  2565. end repeat
  2566. end if
  2567. End PickMouseUpScript
  2568. </script>
  2569. </background>
  2570.